diff options
| author | Isaac Freund <ifreund@ifreund.xyz> | 2020-04-02 14:02:30 +0200 |
|---|---|---|
| committer | Isaac Freund <ifreund@ifreund.xyz> | 2020-04-02 14:02:30 +0200 |
| commit | 9ba295f12673f201b5d70fa3918e270ef41be9f7 (patch) | |
| tree | af32e7129271e2b0d9daeb8ae156ceea33a330be /src/root.zig | |
| parent | 57f27f7cc6a232827a774c3f36035d9290f3b6ce (diff) | |
| download | river-9ba295f12673f201b5d70fa3918e270ef41be9f7.tar.gz river-9ba295f12673f201b5d70fa3918e270ef41be9f7.tar.xz | |
Focus next view if focused view is hidden
Diffstat (limited to 'src/root.zig')
| -rw-r--r-- | src/root.zig | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/root.zig b/src/root.zig index 34cd43d..de2bba0 100644 --- a/src/root.zig +++ b/src/root.zig @@ -314,7 +314,10 @@ pub const Root = struct { // If there were pending focused tags, make them the current focus if (self.pending_focused_tags) |tags| { - Log.Debug.log("changing current focus: {b:0>10} to {b:0>10}", .{ self.current_focused_tags, tags }); + Log.Debug.log( + "changing current focus: {b:0>10} to {b:0>10}", + .{ self.current_focused_tags, tags }, + ); self.current_focused_tags = tags; self.pending_focused_tags = null; } @@ -330,9 +333,20 @@ pub const Root = struct { view.pending_box = null; } + // Apply possible pending tags if (view.pending_tags) |tags| { view.current_tags = tags; view.pending_tags = null; + + // If the pending tags caused the currently focused view to no + // longer be visible, focus the next view. + if (self.focused_view) |focus| { + if (focus == view and + view.current_tags & self.current_focused_tags == 0) + { + self.focusNextView(); + } + } } view.dropStashedBuffer(); |
