diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-02 18:39:09 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-02 18:39:09 +0300 |
| commit | a1c02f044122603ea91f76e65d8cdbd5544d6425 (patch) | |
| tree | f834d059a0849e040a30f3eaf0aafebdc4c0854b /src/pane | |
| parent | 10ba9f023cc48beb406858b9b703347429ebccd1 (diff) | |
fix: anchor ime cursor to focused pane position
Diffstat (limited to 'src/pane')
| -rw-r--r-- | src/pane/terminal.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/pane/terminal.rs b/src/pane/terminal.rs index 0bb7632a..ba1dbea8 100644 --- a/src/pane/terminal.rs +++ b/src/pane/terminal.rs @@ -33,6 +33,13 @@ pub struct ScrollMetrics { } #[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct TerminalCursorState { + pub x: u16, + pub y: u16, + pub visible: bool, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct InputState { pub alternate_screen: bool, pub application_cursor: bool, @@ -118,6 +125,10 @@ impl PaneTerminal { self.ghostty.input_state() } + pub fn cursor_state(&self) -> Option<TerminalCursorState> { + self.ghostty.cursor_state() + } + pub fn visible_text(&self) -> String { self.ghostty.visible_text() } @@ -455,6 +466,22 @@ impl GhosttyPaneTerminal { }) } + pub fn cursor_state(&self) -> Option<TerminalCursorState> { + let mut core = self.core.lock().ok()?; + let GhosttyPaneCore { + terminal, + render_state, + .. + } = &mut *core; + render_state.update(terminal).ok()?; + let cursor = render_state.cursor_viewport().ok()??; + Some(TerminalCursorState { + x: cursor.x, + y: cursor.y, + visible: render_state.cursor_visible().ok()?, + }) + } + pub fn encode_terminal_key( &self, key: crate::input::TerminalKey, |
