diff options
| author | akbash <akbash@herdr.dev> | 2026-08-06 17:38:20 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-06 17:38:20 +0300 |
| commit | 3825c0c30099dbe4cf19627b0525ce09f6580995 (patch) | |
| tree | 7c2387374cc9150eaad170793bba0e0baa0a4068 /src/client | |
| parent | fae0b2365782c59a068fa32ee441afa64626de52 (diff) | |
fix(theme): refresh host appearance on focus (#2417)
* fix(theme): refresh host appearance on focus
refs #2416
* fix(input): preserve split appearance replies
refs #2416
* fix(input): retain fragmented appearance reports
refs #2416
---------
Co-authored-by: akbash-bot <300245827+akbash-bot@users.noreply.github.com>
Co-authored-by: Can Celik <ogulcancelik@gmail.com>
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/input.rs | 1 | ||||
| -rw-r--r-- | src/client/mod.rs | 25 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/client/input.rs b/src/client/input.rs index 9e0d300e..4dc26eae 100644 --- a/src/client/input.rs +++ b/src/client/input.rs @@ -77,6 +77,7 @@ fn unix_stdin_reader_loop( if host_color_query_sent { framer.host_color_query_sent(); framer.enable_host_color_scheme_change_tracking(); + framer.enable_host_appearance_query_on_focus(); } if host_cell_size_query_sent { framer.host_cell_size_query_sent(); diff --git a/src/client/mod.rs b/src/client/mod.rs index fd92d188..b153dd93 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -1442,6 +1442,9 @@ async fn run_client_loop( ) { state.request_repaint(); } + if crate::raw_input::events_require_host_terminal_appearance_query(&events) { + query_host_terminal_appearance(); + } if crate::raw_input::events_require_host_terminal_theme_query(&events) { query_host_terminal_theme(); } @@ -2281,6 +2284,17 @@ fn resize_poll_loop( // Logging // --------------------------------------------------------------------------- +#[cfg(any(not(windows), test))] +fn query_host_terminal_appearance() { + let _ = write_host_terminal_appearance_query(io::stdout()); +} + +#[cfg(any(not(windows), test))] +fn write_host_terminal_appearance_query(mut writer: impl io::Write) -> io::Result<()> { + writer.write_all(crate::terminal_theme::HOST_COLOR_SCHEME_QUERY_SEQUENCE.as_bytes())?; + writer.flush() +} + /// Initialize logging for the client process. fn query_host_terminal_theme() { let _ = write_host_terminal_theme_query(io::stdout()); @@ -2673,6 +2687,13 @@ mod tests { } #[test] + fn write_host_terminal_appearance_query_emits_mode_2031_query() { + let mut output = Vec::new(); + write_host_terminal_appearance_query(&mut output).unwrap(); + assert_eq!(output, b"\x1b[?996n"); + } + + #[test] fn write_host_terminal_theme_query_emits_osc_queries() { let mut output = Vec::new(); write_host_terminal_theme_query(&mut output).unwrap(); @@ -2680,6 +2701,10 @@ mod tests { output, crate::terminal_theme::host_terminal_theme_query_sequence().as_bytes() ); + assert!(!output + .windows(crate::terminal_theme::HOST_COLOR_SCHEME_QUERY_SEQUENCE.len()) + .any(|window| window + == crate::terminal_theme::HOST_COLOR_SCHEME_QUERY_SEQUENCE.as_bytes())); } #[test] |
