Update searchGS.

Ilya Portnov [2011-05-15 18:12:21]
Update searchGS.
Filename
lib/Themes.hs
diff --git a/lib/Themes.hs b/lib/Themes.hs
index 47c50f1..28cdc5b 100644
--- a/lib/Themes.hs
+++ b/lib/Themes.hs
@@ -22,9 +22,26 @@ myGSConfig = defaultGSConfig {

 searchGS :: HasColorizer a => GSConfig a
 searchGS = defaultGSConfig {
-  gs_navigate = navNSearch,
+  gs_navigate = search,
   gs_font = myFont }

+search :: TwoD a (Maybe a)
+search = makeXEventhandler $ shadowWithKeymap navNSearchKeyMap navNSearchDefaultHandler
+  where navNSearchKeyMap = M.fromList [
+           ((0,xK_Escape), cancel)
+          ,((0,xK_Return), select)
+          ,((0,xK_Left)  , move (-1,0) >> search)
+          ,((0,xK_Right) , move (1,0) >> search)
+          ,((0,xK_Down)  , move (0,1) >> search)
+          ,((0,xK_Up)    , move (0,-1) >> search)
+          ,((0,xK_Tab)   , moveNext >> search)
+          ,((shiftMask,xK_Tab), movePrev >> search)
+          ,((0,xK_BackSpace), transformSearchString (\s -> if (s == "") then "" else init s) >> search)
+          ]
+        -- The navigation handler ignores unknown key symbols, therefore we const
+        navNSearchDefaultHandler (_,s,_) = do
+          transformSearchString (++ s)
+          search
 -----------------------------------------------------------------------
 -- Some general settings
 myWorkspaces :: [WorkspaceId]
ViewGit