mirror of
https://github.com/wez/wezterm.git
synced 2024-11-26 08:25:50 +03:00
conpty: work around mangled tmux title sequence
refs: https://github.com/wez/wezterm/issues/2442
This commit is contained in:
parent
3ae647048e
commit
35ed9ac197
@ -35,6 +35,7 @@ As features stabilize some brief notes about them will accumulate here.
|
||||
* `gui-startup` event now also works with `wezterm ssh`
|
||||
* `x` and `+` buttons in the fancy tab bar are now always square [#2399](https://github.com/wez/wezterm/issues/2399)
|
||||
* middle clicking a tab to close it will now confirm closing using the same rules as [CloseCurrentTab](config/lua/keyassignment/CloseCurrentTab.md) [#2350](https://github.com/wez/wezterm/issues/2350)
|
||||
* Emitting the tmux-style `ESC k TITLE ST` sequence via ConPTY breaks output for the pane [#2442](https://github.com/wez/wezterm/issues/2442)
|
||||
|
||||
### 20220807-113146-c2fee766
|
||||
|
||||
|
@ -185,6 +185,20 @@ impl<'a> Performer<'a> {
|
||||
self.print.clear();
|
||||
}
|
||||
|
||||
/// ConPTY, at the time of writing, does something horrible to rewrite
|
||||
/// `ESC k TITLE ST` into something completely different and out-of-order,
|
||||
/// and critically, removes the ST.
|
||||
/// The result is that our hack to accumulate the tmux title gets stuck
|
||||
/// in a mode where all printable output is accumulated for the title.
|
||||
/// To combat this, we pop_tmux_title_state when we're obviously moving
|
||||
/// to different escape sequence parsing states.
|
||||
/// <https://github.com/wez/wezterm/issues/2442>
|
||||
fn pop_tmux_title_state(&mut self) {
|
||||
if let Some(title) = self.accumulating_title.take() {
|
||||
log::warn!("ST never received for pending tmux title escape sequence: {title:?}");
|
||||
}
|
||||
}
|
||||
|
||||
pub fn perform(&mut self, action: Action) {
|
||||
debug!("perform {:?}", action);
|
||||
if self.suppress_initial_title_change {
|
||||
@ -219,6 +233,7 @@ impl<'a> Performer<'a> {
|
||||
}
|
||||
|
||||
fn device_control(&mut self, ctrl: DeviceControlMode) {
|
||||
self.pop_tmux_title_state();
|
||||
match &ctrl {
|
||||
DeviceControlMode::ShortDeviceControl(s) => {
|
||||
match (s.byte, s.intermediates.as_slice()) {
|
||||
@ -294,6 +309,7 @@ impl<'a> Performer<'a> {
|
||||
|
||||
fn control(&mut self, control: ControlCode) {
|
||||
let seqno = self.seqno;
|
||||
self.pop_tmux_title_state();
|
||||
self.flush_print();
|
||||
match control {
|
||||
ControlCode::LineFeed | ControlCode::VerticalTab | ControlCode::FormFeed => {
|
||||
@ -404,6 +420,7 @@ impl<'a> Performer<'a> {
|
||||
}
|
||||
|
||||
fn csi_dispatch(&mut self, csi: CSI) {
|
||||
self.pop_tmux_title_state();
|
||||
self.flush_print();
|
||||
match csi {
|
||||
CSI::Sgr(sgr) => self.state.perform_csi_sgr(sgr),
|
||||
@ -497,6 +514,9 @@ impl<'a> Performer<'a> {
|
||||
fn esc_dispatch(&mut self, esc: Esc) {
|
||||
let seqno = self.seqno;
|
||||
self.flush_print();
|
||||
if esc != Esc::Code(EscCode::StringTerminator) {
|
||||
self.pop_tmux_title_state();
|
||||
}
|
||||
match esc {
|
||||
Esc::Code(EscCode::StringTerminator) => {
|
||||
// String Terminator (ST); for the most part has nothing to do here, as its purpose is
|
||||
@ -638,6 +658,7 @@ impl<'a> Performer<'a> {
|
||||
}
|
||||
|
||||
fn osc_dispatch(&mut self, osc: OperatingSystemCommand) {
|
||||
self.pop_tmux_title_state();
|
||||
self.flush_print();
|
||||
match osc {
|
||||
OperatingSystemCommand::SetIconNameSun(title)
|
||||
|
Loading…
Reference in New Issue
Block a user