Skip to content

Commit

Permalink
Merge pull request #291 from mgsloan/fix-prompt-max-rows-wrap-around-217
Browse files Browse the repository at this point in the history
Fix XMonad.Prompt wraparound when maxComplRows not Nothing #217
  • Loading branch information
byorgey authored Feb 12, 2019
2 parents 1706160 + d9f43c7 commit cd404eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
Added `sorter` to `XPConfig` used to sort the possible completions by how
well they match the search string (example: `XMonad.Prompt.FuzzyMatch`).

Fixes [issue #217](https://github.com/xmonad/xmonad-contrib/issues/217), where
using tab to wrap around the completion rows would fail when maxComplRows is
restricting the number of rows of output.

## 0.15

### Breaking Changes
Expand Down
4 changes: 2 additions & 2 deletions XMonad/Prompt.hs
Original file line number Diff line number Diff line change
Expand Up @@ -851,8 +851,8 @@ bufferOne xs x = (null xs && null x,True)
nextComplIndex :: XPState -> Int -> (Int,Int)
nextComplIndex st nitems = case complWinDim st of
Nothing -> (0,0) --no window dims (just destroyed or not created)
Just (_,_,_,_,_,yy) -> let
(ncols,nrows) = (nitems `div` length yy + if (nitems `mod` length yy > 0) then 1 else 0, length yy)
Just (_,_,_,_,xx,yy) -> let
(ncols,nrows) = (length xx, length yy)
(currentcol,currentrow) = complIndex st
in if (currentcol + 1 >= ncols) then --hlight is in the last column
if (currentrow + 1 < nrows ) then --hlight is still not at the last row
Expand Down

0 comments on commit cd404eb

Please sign in to comment.