diff --git a/src/input_common.rs b/src/input_common.rs index 6b18441c1..6d17f5dec 100644 --- a/src/input_common.rs +++ b/src/input_common.rs @@ -452,7 +452,8 @@ pub fn terminal_protocols_disable_scoped() -> impl ScopeGuarding { ScopeGuard::new((), |()| { // If a child is stopped, this will already be enabled. if TERMINAL_PROTOCOLS.get().borrow().is_none() { - terminal_protocols_enable() + terminal_protocols_enable(); + reader_current_data().unwrap().save_screen_state(); } }) } @@ -527,6 +528,7 @@ pub(crate) fn focus_events_enable_ifn() { if !term_protocols.focus_events { term_protocols.focus_events = true; let _ = write_to_fd("\x1b[?1004h".as_bytes(), STDOUT_FILENO); + reader_current_data().unwrap().save_screen_state(); } } diff --git a/src/reader.rs b/src/reader.rs index e3cc4b419..00ab9b427 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -1142,9 +1142,11 @@ impl ReaderData { &self.parser_ref } - /// Convenience cover over exec_count. - fn exec_count(&self) -> u64 { - self.parser().libdata().pods.exec_count + // We repaint our prompt if fstat reports the tty as having changed. + // But don't react to tty changes that we initiated, because of commands or + // on-variable events (e.g. for fish_bind_mode). See #3481. + pub(crate) fn save_screen_state(&mut self) { + self.screen.save_status(); } /// Do what we need to do whenever our command line changes. @@ -2037,10 +2039,6 @@ impl ReaderData { READAHEAD_MAX, ); - // We repaint our prompt if fstat reports the tty as having changed. - // But don't react to tty changes that we initiated, because of commands or - // on-variable events (e.g. for fish_bind_mode). See #3481. - let mut last_exec_count = self.exec_count(); let mut accumulated_chars = WString::new(); while accumulated_chars.len() < limit { @@ -2067,11 +2065,6 @@ impl ReaderData { } else { continue; }; - - if last_exec_count != self.exec_count() { - last_exec_count = self.exec_count(); - self.screen.save_status(); - } } if !accumulated_chars.is_empty() { @@ -2087,14 +2080,6 @@ impl ReaderData { rls.last_cmd = None; } - if last_exec_count != self.exec_count() { - #[allow(unused_assignments)] - { - last_exec_count = self.exec_count(); - } - self.screen.save_status(); - } - event_needing_handling } }