diff options
Diffstat (limited to 'src/pane.rs')
| -rw-r--r-- | src/pane.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/pane.rs b/src/pane.rs index ae44bde1..51760ecf 100644 --- a/src/pane.rs +++ b/src/pane.rs @@ -26,7 +26,7 @@ use self::{ }; pub use self::{ state::{EffectiveStateChange, PaneState}, - terminal::{InputState, ScrollMetrics}, + terminal::{InputState, ScrollMetrics, TerminalCursorState}, }; const RELEASE_REACQUIRE_SUPPRESSION: std::time::Duration = std::time::Duration::from_secs(1); @@ -684,6 +684,21 @@ impl PaneRuntime { self.terminal.input_state() } + pub fn cursor_state(&self, area: Rect, show_cursor: bool) -> Option<TerminalCursorState> { + if !show_cursor { + return None; + } + let cursor = self.terminal.cursor_state()?; + if cursor.x >= area.width || cursor.y >= area.height { + return None; + } + Some(TerminalCursorState { + x: area.x + cursor.x, + y: area.y + cursor.y, + visible: cursor.visible, + }) + } + pub fn visible_text(&self) -> String { self.terminal.visible_text() } |
