fix a bug when ncompletions = nrows

This commit is contained in:
c.lopez
2012-08-26 08:31:37 +00:00
parent 8f9fa05c0f
commit cd6feb81e2

View File

@@ -527,12 +527,11 @@ completionHandle _ k e = handle k e
nextComplIndex :: XPState -> Int -> (Int,Int)
nextComplIndex st nitems = case complWinDim st of
Nothing -> (0,0) --no window dims (just destroyed or not created)
Just winDim -> let
(_,_,_,_,_,yy) = winDim
Just (_,_,_,_,_,yy) -> let
(ncols,nrows) = (nitems `div` length yy + if (nitems `mod` length yy > 0) then 1 else 0, length yy)
(currentcol,currentrow) = complIndex st
in if (currentcol + 1 >= ncols) then --hlight is in the last column
if (currentrow + 1 < (nitems `mod` nrows) ) then --hlight is still not at the last row
if (currentrow + 1 < nrows ) then --hlight is still not at the last row
(currentcol, currentrow + 1)
else
(0,0)