mirror of https://github.com/dense-analysis/ale
Merge pull request #848 from ilex/master
Fix bug with ALEPrevious for blank lines.
This commit is contained in:
commit
b6f0b17eaf
|
@ -32,7 +32,7 @@ function! ale#loclist_jumping#FindNearest(direction, wrap) abort
|
||||||
\ {
|
\ {
|
||||||
\ 'bufnr': bufnr(''),
|
\ 'bufnr': bufnr(''),
|
||||||
\ 'lnum': l:item.lnum,
|
\ 'lnum': l:item.lnum,
|
||||||
\ 'col': min([max([l:item.col, 1]), len(getline(l:item.lnum))]),
|
\ 'col': min([max([l:item.col, 1]), max([len(getline(l:item.lnum)), 1])]),
|
||||||
\ },
|
\ },
|
||||||
\ l:search_item
|
\ l:search_item
|
||||||
\)
|
\)
|
||||||
|
|
|
@ -33,6 +33,7 @@ Given foobar (Some imaginary filetype):
|
||||||
12345678
|
12345678
|
||||||
12345678
|
12345678
|
||||||
|
|
||||||
|
|
||||||
Execute(loclist jumping should jump correctly when not wrapping):
|
Execute(loclist jumping should jump correctly when not wrapping):
|
||||||
AssertEqual [2, 1], TestJump('before', 0, [2, 2])
|
AssertEqual [2, 1], TestJump('before', 0, [2, 2])
|
||||||
AssertEqual [1, 3], TestJump('before', 0, [2, 1])
|
AssertEqual [1, 3], TestJump('before', 0, [2, 1])
|
||||||
|
@ -74,3 +75,12 @@ Execute(We shouldn't move when jumping to the first item where there are none):
|
||||||
let g:ale_buffer_info[bufnr('%')].loclist = []
|
let g:ale_buffer_info[bufnr('%')].loclist = []
|
||||||
|
|
||||||
AssertEqual [1, 6], TestJump(0, 0, [1, 6])
|
AssertEqual [1, 6], TestJump(0, 0, [1, 6])
|
||||||
|
|
||||||
|
Execute(We should be able to jump when the error line is blank):
|
||||||
|
call add(g:ale_buffer_info[bufnr('%')].loclist, {'bufnr': bufnr(''), 'lnum': 3, 'col': 1})
|
||||||
|
|
||||||
|
AssertEqual 0, len(getline(3))
|
||||||
|
AssertEqual [2, 8], TestJump('before', 0, [3, 1])
|
||||||
|
AssertEqual [2, 8], TestJump('before', 1, [3, 1])
|
||||||
|
AssertEqual [3, 1], TestJump('after', 0, [3, 1])
|
||||||
|
AssertEqual [1, 2], TestJump('after', 1, [3, 1])
|
||||||
|
|
Loading…
Reference in New Issue