diff --git a/autoload/ale/loclist_jumping.vim b/autoload/ale/loclist_jumping.vim index f967e2b0..8a6b0b24 100644 --- a/autoload/ale/loclist_jumping.vim +++ b/autoload/ale/loclist_jumping.vim @@ -14,7 +14,7 @@ function! ale#loclist_jumping#FindNearest(direction, wrap) abort let l:info = get(g:ale_buffer_info, bufnr('%'), {'loclist': []}) " This list will have already been sorted. let l:loclist = l:info.loclist - let l:search_item = {'lnum': l:pos[1], 'col': l:pos[2]} + let l:search_item = {'bufnr': bufnr(''), 'lnum': l:pos[1], 'col': l:pos[2]} " When searching backwards, so we can find the next smallest match. if a:direction is# 'before' @@ -30,6 +30,7 @@ function! ale#loclist_jumping#FindNearest(direction, wrap) abort " cursor to a line without changing the column, in some cases. let l:cmp_value = ale#util#LocItemCompare( \ { + \ 'bufnr': bufnr(''), \ 'lnum': l:item.lnum, \ 'col': min([max([l:item.col, 1]), len(getline(l:item.lnum))]), \ }, diff --git a/test/test_loclist_jumping.vader b/test/test_loclist_jumping.vader index 13eac5ce..793190d1 100644 --- a/test/test_loclist_jumping.vader +++ b/test/test_loclist_jumping.vader @@ -2,13 +2,13 @@ Before: let g:ale_buffer_info = { \ bufnr('%'): { \ 'loclist': [ - \ {'lnum': 1, 'col': 2}, - \ {'lnum': 1, 'col': 3}, - \ {'lnum': 2, 'col': 1}, - \ {'lnum': 2, 'col': 2}, - \ {'lnum': 2, 'col': 3}, - \ {'lnum': 2, 'col': 6}, - \ {'lnum': 2, 'col': 700}, + \ {'bufnr': bufnr(''), 'lnum': 1, 'col': 2}, + \ {'bufnr': bufnr(''), 'lnum': 1, 'col': 3}, + \ {'bufnr': bufnr(''), 'lnum': 2, 'col': 1}, + \ {'bufnr': bufnr(''), 'lnum': 2, 'col': 2}, + \ {'bufnr': bufnr(''), 'lnum': 2, 'col': 3}, + \ {'bufnr': bufnr(''), 'lnum': 2, 'col': 6}, + \ {'bufnr': bufnr(''), 'lnum': 2, 'col': 700}, \ ], \ }, \}