From 3a822e8106b45745f9d463d9167033f977353d9f Mon Sep 17 00:00:00 2001 From: akbash Date: Sat, 5 Sep 2026 04:39:25 +0300 Subject: fix: preserve pixel mouse after sgr reassertion (#3637) refs #3295 Co-authored-by: akbash-bot <300245827+akbash-bot@users.noreply.github.com> --- src/pane/input.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/pane/input.rs') diff --git a/src/pane/input.rs b/src/pane/input.rs index 2ff299c9..8de216e8 100644 --- a/src/pane/input.rs +++ b/src/pane/input.rs @@ -66,17 +66,20 @@ pub(super) fn ghostty_mouse_encoder_for_terminal( encoder.set_from_terminal(terminal); let cols = terminal.cols().ok()? as u32; let rows = terminal.rows().ok()? as u32; + let sgr_pixels = terminal + .mode_get(crate::ghostty::MODE_MOUSE_SGR_PIXELS) + .ok()?; match position { crate::input::mouse::Position::Cell { .. } => { - if terminal - .mode_get(crate::ghostty::MODE_MOUSE_SGR_PIXELS) - .ok()? - { + if sgr_pixels { encoder.set_format(crate::ghostty::MOUSE_FORMAT_SGR); } encoder.set_size(cols, rows, 1, 1); } crate::input::mouse::Position::Pixels { .. } => { + if sgr_pixels { + encoder.set_format(crate::ghostty::MOUSE_FORMAT_SGR_PIXELS); + } let width_px = terminal.width_px().ok()?; let height_px = terminal.height_px().ok()?; if width_px == 0 || height_px == 0 || cols == 0 || rows == 0 { -- cgit v1.2.3