Compare commits

...

2 Commits

Author SHA1 Message Date
Michael Bolin
d8856d77ec Release 0.28.0 2025-09-02 15:08:53 -07:00
Jeremy Rose
60fdfc5f14 tui: catch get_cursor_position errors (#2870)
still seeing errors with reading back the cursor position in some cases;
adding catches everywhere we might run into this.
2025-09-02 14:32:42 -07:00
2 changed files with 8 additions and 4 deletions

View File

@@ -22,7 +22,7 @@ members = [
resolver = "2"
[workspace.package]
version = "0.0.0"
version = "0.28.0"
# Track the edition for all workspace crates in one place. Individual
# crates can still override this value, but keeping it here means new
# crates created with `cargo new -w ...` automatically inherit the 2024

View File

@@ -403,7 +403,10 @@ impl Tui {
) -> Result<Option<PreparedResumeAction>> {
match action {
ResumeAction::RealignInline => {
let cursor_pos = self.terminal.get_cursor_position()?;
let cursor_pos = self
.terminal
.get_cursor_position()
.unwrap_or(self.terminal.last_known_cursor_pos);
Ok(Some(PreparedResumeAction::RealignViewport(
ratatui::layout::Rect::new(0, cursor_pos.y, 0, 0),
)))
@@ -496,8 +499,9 @@ impl Tui {
let terminal = &mut self.terminal;
let screen_size = terminal.size()?;
let last_known_screen_size = terminal.last_known_screen_size;
if screen_size != last_known_screen_size {
let cursor_pos = terminal.get_cursor_position()?;
if screen_size != last_known_screen_size
&& let Ok(cursor_pos) = terminal.get_cursor_position()
{
let last_known_cursor_pos = terminal.last_known_cursor_pos;
if cursor_pos.y != last_known_cursor_pos.y {
let cursor_delta = cursor_pos.y as i32 - last_known_cursor_pos.y as i32;