aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Letan <lthms@soap.coffee>2022-08-25 08:17:43 +0200
committerThomas Letan <lthms@soap.coffee>2022-08-25 08:17:43 +0200
commit1a38bb8d7914065620db7ee872c1026e9ff3b24a (patch)
treedc7f4018ed7fc0dbc0ddb3bd17630cd226e21605
parentUse the command-line argument parsing library Clap in the spatialmsg (diff)
Fix closing the last window of a container
When closing the last window of a container, the code would set the focused window index to -1.
-rw-r--r--bin/spatial/ribbon.ml9
1 files changed, 3 insertions, 6 deletions
diff --git a/bin/spatial/ribbon.ml b/bin/spatial/ribbon.ml
index 69f2914..155b44b 100644
--- a/bin/spatial/ribbon.ml
+++ b/bin/spatial/ribbon.ml
@@ -129,12 +129,9 @@ let remove_window window ribbon =
match ribbon.visible with
| Some (f, l) -> (
match remove window l with
- | Some (idx, l) ->
- let f' =
- if f < idx then f
- else if f = idx && f < List.length l then f
- else f - 1
- in
+ | Some (_, []) -> { ribbon with visible = None }
+ | Some (_, l) ->
+ let f' = if f < List.length l then f else f - 1 in
{ ribbon with visible = Some (f', l) }
| None -> { ribbon with hidden = remove_if_present window ribbon.hidden })
| None -> { ribbon with hidden = remove_if_present window ribbon.hidden }