mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
XMonad.Prompt.FuzzyMatch: handle case when input is not a subsequence of every completion
This commit is contained in:
parent
a69794892b
commit
1a085bec43
@ -111,6 +111,11 @@
|
|||||||
Added `directoryMultipleModes'`, like `directoryMultipleModes` with an additional
|
Added `directoryMultipleModes'`, like `directoryMultipleModes` with an additional
|
||||||
`ComplCaseSensitivity` argument.
|
`ComplCaseSensitivity` argument.
|
||||||
|
|
||||||
|
* `XMonad.Prompt.FuzzyMatch`
|
||||||
|
|
||||||
|
`fuzzySort` will now accept cases where the input is not a subsequence of
|
||||||
|
every completion.
|
||||||
|
|
||||||
* `XMonad.Prompt.Shell`
|
* `XMonad.Prompt.Shell`
|
||||||
|
|
||||||
Added `getShellCompl'`, like `getShellCompl` with an additional `ComplCaseSensitivity`
|
Added `getShellCompl'`, like `getShellCompl` with an additional `ComplCaseSensitivity`
|
||||||
|
@ -80,7 +80,8 @@ fuzzySort :: String -> [String] -> [String]
|
|||||||
fuzzySort q = map snd . sort . map (rankMatch q)
|
fuzzySort q = map snd . sort . map (rankMatch q)
|
||||||
|
|
||||||
rankMatch :: String -> String -> ((Int, Int), String)
|
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 :: String -> String -> [(Int, Int)]
|
||||||
rankMatches [] _ = [(0, 0)]
|
rankMatches [] _ = [(0, 0)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user