mirror of
https://github.com/wez/wezterm.git
synced 2024-11-24 07:46:59 +03:00
term: add implicit SGR reset when switching alt screen
This was a bit of a pain to track down because this behavior isn't specified anywhere or called out explicitly. The issue is that if you use a true color escape sequence such as ```bash printf "\x1b[38;2;255;100;0mTRUECOLOR\n" ``` the active color would remain active when switching between the primary and the alt screen until something (eg: `ls --color`) changed it again. I hadn't run into this because in my prompt, many many years ago, I had it set to perform an SGR reset (`\x1b[0m`) as the first thing to ensure that the shell is in a saner state. For users that don't do this they end up with a weird looking color bleed effect. refs: https://github.com/wez/wezterm/issues/169
This commit is contained in:
parent
c634f35b05
commit
ea401e1f58
@ -1123,6 +1123,7 @@ impl TerminalState {
|
||||
)) => {
|
||||
if !self.screen.is_alt_screen_active() {
|
||||
self.screen.activate_alt_screen();
|
||||
self.pen = CellAttributes::default();
|
||||
}
|
||||
}
|
||||
Mode::ResetDecPrivateMode(DecPrivateMode::Code(
|
||||
@ -1130,6 +1131,7 @@ impl TerminalState {
|
||||
)) => {
|
||||
if self.screen.is_alt_screen_active() {
|
||||
self.screen.activate_primary_screen();
|
||||
self.pen = CellAttributes::default();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1195,6 +1197,7 @@ impl TerminalState {
|
||||
self.save_cursor();
|
||||
self.screen.activate_alt_screen();
|
||||
self.set_cursor_pos(&Position::Absolute(0), &Position::Absolute(0));
|
||||
self.pen = CellAttributes::default();
|
||||
self.erase_in_display(EraseInDisplay::EraseDisplay);
|
||||
}
|
||||
}
|
||||
@ -1204,6 +1207,7 @@ impl TerminalState {
|
||||
if self.screen.is_alt_screen_active() {
|
||||
self.screen.activate_primary_screen();
|
||||
self.restore_cursor();
|
||||
self.pen = CellAttributes::default();
|
||||
}
|
||||
}
|
||||
Mode::SaveDecPrivateMode(DecPrivateMode::Code(_))
|
||||
|
Loading…
Reference in New Issue
Block a user