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.
This commit is contained in:
Rob
2007-05-25 02:41:18 +00:00
parent 654e64b772
commit f8caf7f982

View File

@@ -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