diff options
author | Clemens Fruhwirth <clemens@endorphin.org> | 2010-10-16 20:36:44 +0200 |
---|---|---|
committer | Clemens Fruhwirth <clemens@endorphin.org> | 2010-10-16 20:36:44 +0200 |
commit | 8e72968a2ce3d378f722d68d937cd9a719a1a789 (patch) | |
tree | 00d55de377d490b9e6f7f70896e6ab90529738ce | |
parent | f760f99b123921235507fbdf490f27eee1e1183c (diff) | |
download | XMonadContrib-8e72968a2ce3d378f722d68d937cd9a719a1a789.tar.gz XMonadContrib-8e72968a2ce3d378f722d68d937cd9a719a1a789.tar.xz XMonadContrib-8e72968a2ce3d378f722d68d937cd9a719a1a789.zip |
Add substring filter to td_elementmap
Ignore-this: d28b7173095c504ae0e9209303e4468a
darcs-hash:20101016183644-ed0c4-224c6bb4365206fa99911254c07861bc97b5f164.gz
-rw-r--r-- | XMonad/Actions/GridSelect.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/XMonad/Actions/GridSelect.hs b/XMonad/Actions/GridSelect.hs index f98c226..c83de8b 100644 --- a/XMonad/Actions/GridSelect.hs +++ b/XMonad/Actions/GridSelect.hs @@ -208,13 +208,15 @@ data TwoDState a = TwoDState { td_curpos :: TwoDPosition , td_paneX :: Integer , td_paneY :: Integer , td_drawingWin :: Window + , td_searchString :: String } td_elementmap :: TwoDState a -> [(TwoDPosition,(String,a))] td_elementmap s = let positions = td_availSlots s - elements = td_elements s + elements = L.filter (((td_searchString s) `isSubstringOf`) . fst) (td_elements s) in zipWith (,) positions elements + where sub `isSubstringOf` string = or [ sub `isPrefixOf` t | t <- tails string ] newtype TwoD a b = TwoD { unTwoD :: StateT (TwoDState a) X b } deriving (Monad,Functor,MonadState (TwoDState a)) @@ -455,7 +457,8 @@ gridselect gsconfig elements = td_font = font, td_paneX = screenWidth, td_paneY = screenHeight, - td_drawingWin = win } + td_drawingWin = win, + td_searchString = "" } else return Nothing liftIO $ do |