mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-14 19:55:55 -07:00
X.Prompt: Special handling of one highlighted item
Fixes a bug introduced in f2cfaa3398
.
The changes there allowed the prompt to cycle through its input; it now
becomes necessary to single out the case of only having a single
suggestion that's also highlighted. Otherwise, `hlComplete` (condition:
`alwaysHighlight` is enabled) will loop forever. This case can't be
handled from within hlComplete, as we are giving it incomplete
information to start with (by only calling it with the last word of the
current completion in `handleCompletion`), which is necessary for things
like completing arguments.
This commit is contained in:
@@ -410,8 +410,9 @@ highlightedItem st' completions = case complWinDim st' of
|
||||
(_,_,_,_,xx,yy) = winDim
|
||||
complMatrix = splitInSubListsAt (length yy) (take (length xx * length yy) completions)
|
||||
(col_index,row_index) = complIndex st'
|
||||
in case completions of
|
||||
[] -> Nothing
|
||||
in case length completions of
|
||||
0 -> Nothing
|
||||
1 -> Just $ complMatrix !! col_index !! row_index
|
||||
_ -> complMatrix !? col_index >>= (!? row_index)
|
||||
where
|
||||
-- | Safe version of '(!!)'.
|
||||
|
Reference in New Issue
Block a user