Merge pull request #505 from slotThe/hl-item

X.Prompt: Special handling of one highlighted item
This commit is contained in:
slotThe
2021-04-07 15:26:56 +02:00
committed by GitHub

View File

@@ -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 '(!!)'.