mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-07-31 12:11:52 -07:00
Prompt: Use searchPredicate in more cases
Prompts based on `mkComplFunList` and `mkComplFunList'` were not taking into account the `searchPredicate` funtion from `XPConfig`. This was rather confusing. We fix it by passing `XPConfig` to these functions; although this is strictly more than they need, it makes the breaking change very easy to fix and is also more future-proof.
This commit is contained in:
@@ -1605,19 +1605,18 @@ mkUnmanagedWindow d s rw x y w h = do
|
||||
|
||||
-- | This function takes a list of possible completions and returns a
|
||||
-- completions function to be used with 'mkXPrompt'
|
||||
mkComplFunFromList :: [String] -> String -> IO [String]
|
||||
mkComplFunFromList _ [] = return []
|
||||
mkComplFunFromList l s =
|
||||
return $ filter (\x -> take (length s) x == s) l
|
||||
mkComplFunFromList :: XPConfig -> [String] -> String -> IO [String]
|
||||
mkComplFunFromList _ _ [] = return []
|
||||
mkComplFunFromList c l s =
|
||||
pure $ filter (searchPredicate c s) l
|
||||
|
||||
-- | This function takes a list of possible completions and returns a
|
||||
-- completions function to be used with 'mkXPrompt'. If the string is
|
||||
-- null it will return all completions.
|
||||
mkComplFunFromList' :: [String] -> String -> IO [String]
|
||||
mkComplFunFromList' l [] = return l
|
||||
mkComplFunFromList' l s =
|
||||
return $ filter (\x -> take (length s) x == s) l
|
||||
|
||||
mkComplFunFromList' :: XPConfig -> [String] -> String -> IO [String]
|
||||
mkComplFunFromList' _ l [] = return l
|
||||
mkComplFunFromList' c l s =
|
||||
pure $ filter (searchPredicate c s) l
|
||||
|
||||
-- | Given the prompt type, the command line and the completion list,
|
||||
-- return the next completion in the list for the last word of the
|
||||
|
Reference in New Issue
Block a user