1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-25 21:07:39 +03:00

fix excessive calls to format-tab-title

* Removed title update from main render loop
* Add to PaneFocused event
* term: only emit Alert::OutputSinceFocusLost for the first
  seqno bump after losing focus, rather than on every bump.
  That event indirectly causes the title to update

refs: https://github.com/wez/wezterm/issues/4788
This commit is contained in:
Wez Furlong 2024-01-25 23:14:38 -07:00
parent 29d8bcc6ea
commit 7f3a835548
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387
4 changed files with 17 additions and 4 deletions

View File

@ -175,6 +175,8 @@ As features stabilize some brief notes about them will accumulate here.
accounts for window padding. Thanks to @jknockel! #4824
* Bar shaped text cursors are now rendered above text. Thanks to
@ErrorNoInternet! #4850
* `format-tab-title` event was triggered excessively for background tabs/panes.
Thanks to @crides for investigating! #4788
#### Updated
* Bundled harfbuzz to 8.3.0

View File

@ -378,7 +378,10 @@ pub struct TerminalState {
accumulating_title: Option<String>,
/// seqno when we last lost focus
lost_focus_seqno: SequenceNo,
/// seqno when we last emitted Alert::OutputSinceFocusLost
lost_focus_alerted_seqno: SequenceNo,
focused: bool,
/// True if lines should be marked as bidi-enabled, and thus
@ -575,6 +578,7 @@ impl TerminalState {
enable_conpty_quirks: false,
accumulating_title: None,
lost_focus_seqno: seqno,
lost_focus_alerted_seqno: seqno,
focused: true,
bidi_enabled: None,
bidi_hint: None,
@ -795,11 +799,18 @@ impl TerminalState {
pub(crate) fn trigger_unseen_output_notif(&mut self) {
if self.has_unseen_output() {
// We want to avoid over-notifying about output events,
// so here we gate the notification to the case where
// we have lost the focus more recently than the last
// time we notified about it
if self.lost_focus_seqno > self.lost_focus_alerted_seqno {
self.lost_focus_alerted_seqno = self.seqno;
if let Some(handler) = self.alert_handler.as_mut() {
handler.alert(Alert::OutputSinceFocusLost);
}
}
}
}
/// Send text to the terminal that is the result of pasting.
/// If bracketed paste mode is enabled, the paste is enclosed

View File

@ -1228,7 +1228,8 @@ impl TermWindow {
// Handled by frontend
}
MuxNotification::PaneFocused(_) => {
// Handled by clientpane
// Also handled by clientpane
self.update_title_post_status();
}
MuxNotification::TabResized(_) => {
// Handled by wezterm-client

View File

@ -114,7 +114,6 @@ impl crate::TermWindow {
);
metrics::histogram!("gui.paint.impl", self.last_frame_duration);
metrics::histogram!("gui.paint.impl.rate", 1.);
self.update_title_post_status();
// If self.has_animation is some, then the last render detected
// image attachments with multiple frames, so we also need to