diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/history.rs | 17 | ||||
-rw-r--r-- | src/readline.rs | 3 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/history.rs b/src/history.rs index 8652d6b..d2a1b0a 100644 --- a/src/history.rs +++ b/src/history.rs @@ -305,7 +305,9 @@ impl HistoryEntry { } let mut out_row = out.screen().cursor_position().0 + 1; let screen = self.vt.screen(); + let pos = screen.cursor_position(); let mut wrapped = false; + let mut cursor_found = None; for (idx, row) in screen .rows_formatted(0, width) .enumerate() @@ -319,8 +321,23 @@ impl HistoryEntry { } out.write(&row); wrapped = screen.row_wrapped(idx); + if pos.0 == idx { + cursor_found = Some(out_row); + } out_row += 1; } + if focused { + if let Some(row) = cursor_found { + if screen.hide_cursor() { + out.write(b"\x1b[?25l"); + } else { + out.write(b"\x1b[?25h"); + out.move_to(row, pos.1); + } + } else { + out.write(b"\x1b[?25l"); + } + } out.reset_attributes(); } diff --git a/src/readline.rs b/src/readline.rs index 2040c10..be05533 100644 --- a/src/readline.rs +++ b/src/readline.rs @@ -87,6 +87,9 @@ impl Readline { ); out.reset_attributes(); out.move_to(self.size.0 - 1, self.prompt_width() + self.pos_width()); + if focus { + out.write(b"\x1b[?25h"); + } Ok(()) } |