@@ -356,7 +356,6 @@ local function follow_prev(list, items, bufnr, line, col)
356
356
357
357
local valid = is_valid (item )
358
358
if valid then
359
- last_valid = j
360
359
-- We overshot the current buffer
361
360
if found_buf and item .bufnr ~= bufnr then
362
361
return j
@@ -365,7 +364,7 @@ local function follow_prev(list, items, bufnr, line, col)
365
364
-- If the current entry is past cursor, of the entry of the cursor has been
366
365
-- passed
367
366
item .col = math.min (item .col , linelen (item .bufnr , item .lnum ))
368
- if item .lnum < line or (item .lnum == line and col and item .col < col ) then
367
+ if item .lnum < line or (item .lnum == line and ( item . col > 0 and col and item .col < col ) ) then
369
368
return j
370
369
end
371
370
end
@@ -383,12 +382,10 @@ end
383
382
-- Returns the first entry after the cursor in buf or the first entry in the
384
383
-- buffer
385
384
local function follow_next (list , items , bufnr , line , col )
386
- local last_valid = 1
387
385
local found_buf = false
388
386
for i , item in ipairs (items ) do
389
387
local valid = is_valid (item )
390
388
if valid then
391
- last_valid = i
392
389
-- We overshot the current buffer
393
390
if found_buf and item .bufnr ~= bufnr then
394
391
return i
@@ -397,7 +394,7 @@ local function follow_next(list, items, bufnr, line, col)
397
394
-- If the current entry is past cursor, of the entry of the cursor has been
398
395
-- passed
399
396
item .col = math.min (item .col , linelen (item .bufnr , item .lnum ))
400
- if item .lnum > line or (item .lnum == line and col and item .col > col ) then
397
+ if item .lnum > line or (item .lnum == line and ( item . col > 0 and col and item .col > col ) ) then
401
398
return i
402
399
end
403
400
end
0 commit comments