From 6122cd030e03945382dad927c32a259c077bd468 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Wed, 3 Aug 2022 15:49:24 -0600 Subject: Add check for xK_Escape to end trynig ot type a Wml object. --- src/Rahm/Desktop/Keys/Wml.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Rahm/Desktop/Keys/Wml.hs b/src/Rahm/Desktop/Keys/Wml.hs index 9074b66..34dabd2 100644 --- a/src/Rahm/Desktop/Keys/Wml.hs +++ b/src/Rahm/Desktop/Keys/Wml.hs @@ -214,6 +214,8 @@ readNextWorkspace :: (KeyFeeder m) => MaybeT m Workspace readNextWorkspace = readNextKey $ \mask sym str -> case (mask, sym, str) of + (_, e, _) | e == xK_Escape -> MaybeT $ return Nothing + (_, _, [ch]) | isAlphaNum ch || ch == '*' -> return $ justWorkspace [ch] (_, _, "[") -> justWorkspace <$> @@ -291,14 +293,14 @@ readNextWorkspace = then ws3 else ws4 - -- ?&s@.'@s - (_, _, "?") -> do l1 <- readNextLocationSet ws1 <- readNextWorkspace ws2 <- readNextWorkspace + mt $ logs Trace "If not empty %s then %s else %s" (show l1) (show $ workspaceName ws1) (show $ workspaceName ws2) + return $ if null l1 then ws2 @@ -315,6 +317,8 @@ readNextLocationSet :: (KeyFeeder m) => MaybeT m [Location] readNextLocationSet = readNextKey $ \mask sym str -> case (mask, sym, str) of + (_, e, _) | e == xK_Escape -> MaybeT $ return Nothing + (_, _, [ch]) | isAlpha ch -> mt $ getMarkedLocations [ch] (_, _, "0") -> (:[]) <$> MaybeT (fromX getMostRecentLocationInHistory) (_, _, [ch]) | isDigit ch -> -- cgit