From e6b614673144ed5d39a7a8d989b3904a45af1199 Mon Sep 17 00:00:00 2001 From: w0rp Date: Sat, 12 Aug 2017 14:49:02 +0100 Subject: [PATCH] #653 - Fix loclist jumping so it works with buffer numbers --- autoload/ale/loclist_jumping.vim | 3 ++- test/test_loclist_jumping.vader | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) 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}, \ ], \ }, \}