aboutsummaryrefslogtreecommitdiff
path: root/src/pane.rs
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-05-02 18:39:09 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-05-02 18:39:09 +0300
commita1c02f044122603ea91f76e65d8cdbd5544d6425 (patch)
treef834d059a0849e040a30f3eaf0aafebdc4c0854b /src/pane.rs
parent10ba9f023cc48beb406858b9b703347429ebccd1 (diff)
fix: anchor ime cursor to focused pane position
Diffstat (limited to 'src/pane.rs')
-rw-r--r--src/pane.rs17
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()
}