From a1c02f044122603ea91f76e65d8cdbd5544d6425 Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Sat, 2 May 2026 18:39:09 +0300 Subject: fix: anchor ime cursor to focused pane position --- src/pane.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/pane.rs') 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 { + 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() } -- cgit v1.2.3