mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
X.Prompt: Document getCompletions
This commit is contained in:
parent
26c4fb0f2d
commit
aa35d6a2f2
@ -1499,21 +1499,21 @@ printPrompt drw = do
|
|||||||
-- flip back to the original colors and print the rest of the string
|
-- flip back to the original colors and print the rest of the string
|
||||||
draw (fgNormal color) (bgNormal color) (x + fi (pcFont + cFont)) y postCursor
|
draw (fgNormal color) (bgNormal color) (x + fi (pcFont + cFont)) y postCursor
|
||||||
|
|
||||||
-- get the current completion function depending on the active mode
|
-- | Get all available completions for the current input.
|
||||||
|
getCompletions :: XP [String]
|
||||||
|
getCompletions = do
|
||||||
|
st@XPS{ config } <- get
|
||||||
|
let cmd = commandToComplete (currentXPMode st) (command st)
|
||||||
|
compl = getCompletionFunction st
|
||||||
|
srt = sorter config
|
||||||
|
io $ (srt cmd <$> compl cmd) `E.catch` \(SomeException _) -> return []
|
||||||
|
where
|
||||||
|
-- | Get the current completion function depending on the active mode.
|
||||||
getCompletionFunction :: XPState -> ComplFunction
|
getCompletionFunction :: XPState -> ComplFunction
|
||||||
getCompletionFunction st = case operationMode st of
|
getCompletionFunction st = case operationMode st of
|
||||||
XPSingleMode compl _ -> compl
|
XPSingleMode compl _ -> compl
|
||||||
XPMultipleModes modes -> completionFunction $ W.focus modes
|
XPMultipleModes modes -> completionFunction $ W.focus modes
|
||||||
|
|
||||||
-- Completions
|
|
||||||
getCompletions :: XP [String]
|
|
||||||
getCompletions = do
|
|
||||||
s <- get
|
|
||||||
let q = commandToComplete (currentXPMode s) (command s)
|
|
||||||
compl = getCompletionFunction s
|
|
||||||
srt = sorter (config s)
|
|
||||||
io $ (srt q <$> compl q) `E.catch` \(SomeException _) -> return []
|
|
||||||
|
|
||||||
destroyComplWin :: XP ()
|
destroyComplWin :: XP ()
|
||||||
destroyComplWin = do
|
destroyComplWin = do
|
||||||
d <- gets dpy
|
d <- gets dpy
|
||||||
|
Loading…
x
Reference in New Issue
Block a user