summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Creighton <jcreigh@gmail.com>2007-03-18 01:55:25 +0100
committerJason Creighton <jcreigh@gmail.com>2007-03-18 01:55:25 +0100
commitaca8752d104f389c313cbaeb84a81917842229a9 (patch)
treee19812327efc502ad7409b2950e9b4e6efee7c39
parent6ed3ba2d0e2cc40d1cabcb51d22a71bcecbbc851 (diff)
downloadmetatile-aca8752d104f389c313cbaeb84a81917842229a9.tar
metatile-aca8752d104f389c313cbaeb84a81917842229a9.zip
replaced "let Just x = ..." in view with "case ... of ..."
darcs-hash:20070318005525-b9aa7-9f42706bf37b46fd853388395c9c495346abcc74
-rw-r--r--Main.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/Main.hs b/Main.hs
index d13e7a9..ab6caa3 100644
--- a/Main.hs
+++ b/Main.hs
@@ -336,10 +336,13 @@ view o = do
if M.member n ws2sc
then windows $ W.view n
else do
- -- This assumes that the current workspace is visible.
- -- Is that always going to be true?
- let Just curscreen = M.lookup m ws2sc
- modify $ \s -> s { wsOnScreen = M.insert n curscreen (M.delete m ws2sc) }
+ sc <- case M.lookup m ws2sc of
+ Nothing -> do
+ trace "Current workspace isn't visible! This should never happen!"
+ -- we don't know what screen to use, just use the first one.
+ return 0
+ Just sc -> return sc
+ modify $ \s -> s { wsOnScreen = M.insert n sc (M.filter (/=sc) ws2sc) }
windows $ W.view n
mapM_ hide (W.index m ws)
setTopFocus