diff --git a/term/src/terminalstate/mod.rs b/term/src/terminalstate/mod.rs index d7a1fab2c..fc12cc005 100644 --- a/term/src/terminalstate/mod.rs +++ b/term/src/terminalstate/mod.rs @@ -1345,6 +1345,22 @@ impl TerminalState { } } + /// Indicates that mode is permanently enabled + fn decqrm_response_permanent(&mut self, mode: Mode) { + let (is_dec, number) = match &mode { + Mode::QueryDecPrivateMode(DecPrivateMode::Code(code)) => (true, code.to_u16().unwrap()), + Mode::QueryDecPrivateMode(DecPrivateMode::Unspecified(code)) => (true, *code), + Mode::QueryMode(TerminalMode::Code(code)) => (false, code.to_u16().unwrap()), + Mode::QueryMode(TerminalMode::Unspecified(code)) => (false, *code), + _ => unreachable!(), + }; + + let prefix = if is_dec { "?" } else { "" }; + + write!(self.writer, "\x1b[{prefix}{number};3$y").ok(); + self.writer.flush().ok(); + } + fn decqrm_response(&mut self, mode: Mode, mut recognized: bool, enabled: bool) { let (is_dec, number) = match &mode { Mode::QueryDecPrivateMode(DecPrivateMode::Code(code)) => (true, code.to_u16().unwrap()), @@ -1449,6 +1465,21 @@ impl TerminalState { self.decqrm_response(mode, true, self.left_and_right_margin_mode); } + Mode::SetDecPrivateMode(DecPrivateMode::Code( + DecPrivateModeCode::GraphemeClustering, + )) + | Mode::ResetDecPrivateMode(DecPrivateMode::Code( + DecPrivateModeCode::GraphemeClustering, + )) => { + // Permanently enabled + } + + Mode::QueryDecPrivateMode(DecPrivateMode::Code( + DecPrivateModeCode::GraphemeClustering, + )) => { + self.decqrm_response_permanent(mode); + } + Mode::SetDecPrivateMode(DecPrivateMode::Code(DecPrivateModeCode::SaveCursor)) => { self.dec_save_cursor(); } diff --git a/termwiz/src/escape/csi.rs b/termwiz/src/escape/csi.rs index fe7a2cee7..810f99f1f 100644 --- a/termwiz/src/escape/csi.rs +++ b/termwiz/src/escape/csi.rs @@ -841,6 +841,11 @@ pub enum DecPrivateModeCode { EnableAlternateScreen = 47, OptEnableAlternateScreen = 1047, BracketedPaste = 2004, + + /// + /// Grapheme clustering mode + GraphemeClustering = 2027, + /// Applies to sixel and regis modes UsePrivateColorRegistersForEachGraphic = 1070,