diff options
author | Spencer Janssen <sjanssen@cse.unl.edu> | 2007-05-08 16:39:51 +0200 |
---|---|---|
committer | Spencer Janssen <sjanssen@cse.unl.edu> | 2007-05-08 16:39:51 +0200 |
commit | 9919351b310d7786a1456a120fe6947b5420e5b1 (patch) | |
tree | 56b46061aa5d1fb7b6318433eab2f03e38bef23b | |
parent | 7bbf626d3ded6dc4052640949af553455aaf14c1 (diff) | |
download | xmonad-9919351b310d7786a1456a120fe6947b5420e5b1.tar.gz xmonad-9919351b310d7786a1456a120fe6947b5420e5b1.tar.xz xmonad-9919351b310d7786a1456a120fe6947b5420e5b1.zip |
StackSet.view: ignore invalid indices
darcs-hash:20070508143951-a5988-5b1aea6415436bc5cee632a60efc42300cfbf1e9.gz
-rw-r--r-- | StackSet.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/StackSet.hs b/StackSet.hs index 7883daa..74d63eb 100644 --- a/StackSet.hs +++ b/StackSet.hs @@ -104,13 +104,13 @@ index k w = uncurry (++) $ fromJust $ M.lookup k (stacks w) -- | view. Set the stack specified by the argument as being visible and the -- current StackSet. If the stack wasn't previously visible, it will become --- visible on the current screen. If the index is out of range an exception is --- thrown. +-- visible on the current screen. If the index is out of range 'view' returns +-- the initial 'StackSet' unchanged. view :: (Integral i, Integral j) => i -> StackSet i j a -> StackSet i j a view n w | M.member n (stacks w) = if M.member n (ws2screen w) then w { current = n } else tweak (fromJust $ screen (current w) w) - | otherwise = error $ "view: index out of bounds: " ++ show n + | otherwise = w where tweak sc = w { screen2ws = M.insert sc n (screen2ws w) , ws2screen = M.insert n sc (M.filter (/=sc) (ws2screen w)) |