From a115fc0df77091ada2497fde22bc5c013e860ecd Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Thu, 16 Mar 2023 21:53:13 -0700 Subject: [PATCH] fix iterm2 image cursor position refs: https://github.com/wez/wezterm/issues/3266 --- docs/changelog.md | 2 ++ term/src/terminalstate/image.rs | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index 3cb86f309..227ec7d47 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -138,6 +138,8 @@ As features stabilize some brief notes about them will accumulate here. * Default [hyperlink_rules](config/lua/config/hyperlink_rules.md) now match URLs with port numbers [#928](https://github.com/wez/wezterm/issues/928) +* Incorrect cursor position after processing iTerm2 image escape sequence + [#3266](https://github.com/wez/wezterm/issues/3266) #### Changed * `CTRL-SHIFT-P` now activates the new [command diff --git a/term/src/terminalstate/image.rs b/term/src/terminalstate/image.rs index 3659a1b98..7fbf1d83d 100644 --- a/term/src/terminalstate/image.rs +++ b/term/src/terminalstate/image.rs @@ -196,7 +196,7 @@ impl TerminalState { xpos += x_delta; } ypos += y_delta; - if !params.do_not_move_cursor { + if !params.do_not_move_cursor && y < height_in_cells - 1 { self.new_line(false); } } @@ -213,7 +213,7 @@ impl TerminalState { if bottom_right { self.set_cursor_pos( &Position::Relative(width_in_cells as i64), - &Position::Relative(-1), + &Position::Relative(0), ); } }