terminal/tmux: exhaustive switch for command

pull/9860/head
Mitchell Hashimoto 2025-12-09 13:52:53 -08:00
parent 938e419e04
commit 64ef640127
No known key found for this signature in database
GPG Key ID: 523D5DC389D273BC
1 changed files with 26 additions and 3 deletions

View File

@ -18,6 +18,8 @@ const log = std.log.scoped(.terminal_tmux_viewer);
// out of order. // out of order.
// - We need to ignore `output` for panes that aren't yet initialized // - We need to ignore `output` for panes that aren't yet initialized
// (until capture-panes are complete). // (until capture-panes are complete).
// - We should note what the active window pane is on the tmux side;
// we can use this at least for initial focus.
// NOTE: There is some fragility here that can possibly break if tmux // NOTE: There is some fragility here that can possibly break if tmux
// changes their implementation. In particular, the order of notifications // changes their implementation. In particular, the order of notifications
@ -332,9 +334,30 @@ pub const Viewer = struct {
break :output &.{}; break :output &.{};
}, },
// TODO: Use exhaustive matching here, determine if we need // TODO: There's real logic to do for these.
// to handle the other cases. .session_changed,
else => &.{}, .layout_change,
.window_add,
=> &.{},
// The active pane changed. We don't care about this because
// we handle our own focus.
.window_pane_changed => &.{},
// We ignore this one. It means a session was created or
// destroyed. If it was our own session we will get an exit
// notification very soon. If it is another session we don't
// care.
.sessions_changed => &.{},
// We don't use window names for anything, currently.
.window_renamed => &.{},
// This is for other clients, which we don't do anything about.
// For us, we'll get `exit` or `session_changed`, respectively.
.client_detached,
.client_session_changed,
=> &.{},
}; };
} }