From e28b3cec4ef30940a3bc2cb8ac6073dd993a6ab9 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Mon, 3 Apr 2023 21:12:18 -0700 Subject: [PATCH] mux: fix unseen output status for remote panes refs: #2625 --- docs/changelog.md | 3 +++ wezterm-client/src/pane/clientpane.rs | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/docs/changelog.md b/docs/changelog.md index 00ded3a3e..9add92a1a 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -84,6 +84,9 @@ As features stabilize some brief notes about them will accumulate here. * ssh: `%r` `%h` and `%p` tokens were implicitly supported by libssh but stopped working in `ProxyCommand` when we took over running the proxy command. #3437 * mux: Improved latency for large window sizes. #1872 +* mux: [pane:has_unseen_output()](config/lua/pane/has_unseen_output.md) and + [PaneInformation.has_unseen_output](config/lua/PaneInformation.md) now work + with multiplexer panes. #2625 ### 20230326-111934-3666303c diff --git a/wezterm-client/src/pane/clientpane.rs b/wezterm-client/src/pane/clientpane.rs index 302c97d75..a187620c4 100644 --- a/wezterm-client/src/pane/clientpane.rs +++ b/wezterm-client/src/pane/clientpane.rs @@ -47,6 +47,7 @@ pub struct ClientPane { ignore_next_kill: Mutex, user_vars: Mutex>, config: Mutex>>, + unseen_output: Mutex, } impl ClientPane { @@ -125,6 +126,7 @@ impl ClientPane { clipboard: Mutex::new(None), mouse_grabbed: Mutex::new(false), ignore_next_kill: Mutex::new(false), + unseen_output: Mutex::new(false), user_vars: Mutex::new(HashMap::new()), config: Mutex::new(None), } @@ -181,6 +183,13 @@ impl ClientPane { Alert::SetUserVar { name, value } => { self.user_vars.lock().insert(name.clone(), value.clone()); } + Alert::OutputSinceFocusLost => { + *self.unseen_output.lock() = true; + mux.notify(MuxNotification::Alert { + pane_id: self.local_pane_id, + alert: Alert::OutputSinceFocusLost, + }); + } _ => {} } mux.notify(MuxNotification::Alert { @@ -535,6 +544,7 @@ impl Pane for ClientPane { fn focus_changed(&self, focused: bool) { if focused { self.advise_focus(); + *self.unseen_output.lock() = false; } } @@ -571,6 +581,10 @@ impl Pane for ClientPane { } } + fn has_unseen_output(&self) -> bool { + *self.unseen_output.lock() + } + fn can_close_without_prompting(&self, reason: CloseReason) -> bool { match reason { CloseReason::Window => true,