mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-28 18:03:48 -07:00
XMonad.Prompt.FuzzyMatch: handle case when input is not a subsequence of every completion
This commit is contained in:
@@ -111,6 +111,11 @@
|
||||
Added `directoryMultipleModes'`, like `directoryMultipleModes` with an additional
|
||||
`ComplCaseSensitivity` argument.
|
||||
|
||||
* `XMonad.Prompt.FuzzyMatch`
|
||||
|
||||
`fuzzySort` will now accept cases where the input is not a subsequence of
|
||||
every completion.
|
||||
|
||||
* `XMonad.Prompt.Shell`
|
||||
|
||||
Added `getShellCompl'`, like `getShellCompl` with an additional `ComplCaseSensitivity`
|
||||
|
@@ -80,7 +80,8 @@ fuzzySort :: String -> [String] -> [String]
|
||||
fuzzySort q = map snd . sort . map (rankMatch q)
|
||||
|
||||
rankMatch :: String -> String -> ((Int, Int), String)
|
||||
rankMatch q s = (minimum $ rankMatches q s, s)
|
||||
rankMatch q s = (if null matches then (maxBound, maxBound) else minimum matches, s)
|
||||
where matches = rankMatches q s
|
||||
|
||||
rankMatches :: String -> String -> [(Int, Int)]
|
||||
rankMatches [] _ = [(0, 0)]
|
||||
|
Reference in New Issue
Block a user