diff options
| author | Aram Drevekenin <aram@poor.dev> | 2026-04-29 14:12:05 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-29 14:12:05 +0200 |
| commit | 79c0e2088786fe72050eb4dadf41da1c1ac4afad (patch) | |
| tree | 99d55ef60360cb7440c57f912f8fad9298da8ddb | |
| parent | Support CSI2031 (dark/light theme switching) + remove STDIN cache to avoid st... (diff) | |
| download | sl0ppij-79c0e2088786fe72050eb4dadf41da1c1ac4afad.tar.gz sl0ppij-79c0e2088786fe72050eb4dadf41da1c1ac4afad.tar.xz sl0ppij-79c0e2088786fe72050eb4dadf41da1c1ac4afad.zip | |
Implement DECQRM for CSI2031 (#5111)
* implement DECQRM for CSI2031
* add pr
| -rw-r--r-- | CHANGELOG.md | 2 | ||||
| -rw-r--r-- | zellij-server/src/panes/grid.rs | 9 | ||||
| -rw-r--r-- | zellij-server/src/panes/unit/grid_tests.rs | 41 |
3 files changed, 51 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index aa583406..05c6080e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) * fix: occasional dropped characters in web client (https://github.com/zellij-org/zellij/pull/5080) * fix: restore kitty keyboard mode on error, handle DECRPM 2026 state 3, clean up client terminal teardown sequences (https://github.com/zellij-org/zellij/pull/5058) * fix: prevent occasional duplicate characters in the web client due to IME (https://github.com/zellij-org/zellij/pull/4975) -* feat: support `CSI 2031` + dark/light mode theme switching (https://github.com/zellij-org/zellij/pull/5105) +* feat: support `CSI 2031` + dark/light mode theme switching (https://github.com/zellij-org/zellij/pull/5105 and https://github.com/zellij-org/zellij/pull/5111) ## [0.44.1] - 2026-04-07 * fix: don't display default ports as offline in `share` plugin (https://github.com/zellij-org/zellij/pull/4908) diff --git a/zellij-server/src/panes/grid.rs b/zellij-server/src/panes/grid.rs index ee468e7b..9f6134cb 100644 --- a/zellij-server/src/panes/grid.rs +++ b/zellij-server/src/panes/grid.rs @@ -4084,6 +4084,15 @@ impl Perform for Grid { self.pending_messages_to_pty .push(response.as_bytes().to_vec()); }, + 2031 => { + let value = if self.color_palette_notification_enabled { + 1 + } else { + 2 + }; + let response = format!("\u{1b}[?2031;{}$y", value); + self.pending_messages_to_pty.push(response.into_bytes()); + }, _ => {}, } } diff --git a/zellij-server/src/panes/unit/grid_tests.rs b/zellij-server/src/panes/unit/grid_tests.rs index 8e8618b6..099a3ca8 100644 --- a/zellij-server/src/panes/unit/grid_tests.rs +++ b/zellij-server/src/panes/unit/grid_tests.rs @@ -5904,6 +5904,47 @@ fn csi_2026_dollar_p_stays_local() { } #[test] +fn csi_2031_dollar_p_when_disabled_replies_reset() { + // DECRQM mode 2031 (Application Theme Reporting) is per-pane state + // tracked locally by Zellij. With no prior `CSI ? 2031 h`, the mode + // is reset, so the DECRPM reply must report value=2. + let mut parser = vte::Parser::new(); + let mut grid = new_grid_for_forwarding_test(); + for byte in b"\x1b[?2031$p" { + parser.advance(&mut grid, *byte); + } + assert!( + grid.pending_forwarded_queries.is_empty(), + "CSI ?2031$p is answered locally, must not forward" + ); + assert_eq!(grid.pending_messages_to_pty.len(), 1); + assert_eq!( + grid.pending_messages_to_pty[0], b"\x1b[?2031;2$y", + "DECRPM reply must report value=2 (reset) when 2031 is disabled" + ); +} + +#[test] +fn csi_2031_dollar_p_when_enabled_replies_set() { + // After `CSI ? 2031 h` enables theme-change notifications on this + // pane, a DECRQM probe must report value=1 (set). + let mut parser = vte::Parser::new(); + let mut grid = new_grid_for_forwarding_test(); + for byte in b"\x1b[?2031h\x1b[?2031$p" { + parser.advance(&mut grid, *byte); + } + assert!( + grid.pending_forwarded_queries.is_empty(), + "CSI ?2031$p is answered locally, must not forward" + ); + assert_eq!(grid.pending_messages_to_pty.len(), 1); + assert_eq!( + grid.pending_messages_to_pty[0], b"\x1b[?2031;1$y", + "DECRPM reply must report value=1 (set) when 2031 is enabled" + ); +} + +#[test] fn csi_22t_and_23t_stay_local() { // CSI 22t / 23t manipulate the pane's title stack — Zellij owns // that state, so forwarding would route an app's push/pop to the |
