summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob <bobstopper@bobturf.org>2007-05-25 04:41:18 +0200
committerRob <bobstopper@bobturf.org>2007-05-25 04:41:18 +0200
commit2cdf36f4d4629e2cea75c4f333951c69c76d5b24 (patch)
tree2dfab7a361de820b79c86250d065eaf676d48a2d
parent5e3ddbe901826a82621f7f0af04c390ebc8c77e3 (diff)
downloadmetatile-2cdf36f4d4629e2cea75c4f333951c69c76d5b24.tar
metatile-2cdf36f4d4629e2cea75c4f333951c69c76d5b24.zip
Deleting a window should not affect focus
This fixes a bug whereby deleting a window will first move focus to that window before deleting it without moving focus back afterwards. The fix generalises the remove inner function to delete a window from the stack whether it's in focus or not. If the window is in focus, behaviour remains as it was. darcs-hash:20070525024118-64d90-a9f70b49186be59e62af4b11671099996c5e294f
-rw-r--r--StackSet.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/StackSet.hs b/StackSet.hs
index fe9d20c..b00c67e 100644
--- a/StackSet.hs
+++ b/StackSet.hs
@@ -345,13 +345,16 @@ delete w s | Just w == peek s = remove s -- common case.
| otherwise = maybe s (removeWindow.tag.workspace.current $ s) (findIndex w s)
where
-- find and remove window script
- removeWindow o n = foldr ($) s [view o,remove ,until ((Just w ==) . peek) focusLeft,view n]
+ removeWindow o n = foldr ($) s [view o,remove,view n]
-- actual removal logic, and focus/master logic:
- remove = modify Empty $ \c -> case c of
+ remove = modify Empty $ \c ->
+ if focus c == w
+ then case c of
Node _ ls (r:rs) -> Node r ls rs -- try right first
Node _ (l:ls) [] -> Node l ls [] -- else left.
Node _ [] [] -> Empty
+ else c { left = w `L.delete` left c, right = w `L.delete` right c }
------------------------------------------------------------------------
-- Setting the master window