mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-10 06:21:53 +08:00
Fix #1317 - Jump to column 1 for problems at column 0
This commit is contained in:
@@ -111,7 +111,7 @@ function! ale#loclist_jumping#Jump(direction, ...) abort
|
|||||||
|
|
||||||
if !empty(l:nearest)
|
if !empty(l:nearest)
|
||||||
normal! m`
|
normal! m`
|
||||||
call cursor(l:nearest)
|
call cursor([l:nearest[0], max([l:nearest[1], 1])])
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ Before:
|
|||||||
if type(a:position) == type(0)
|
if type(a:position) == type(0)
|
||||||
call ale#loclist_jumping#JumpToIndex(a:position)
|
call ale#loclist_jumping#JumpToIndex(a:position)
|
||||||
else
|
else
|
||||||
call ale#loclist_jumping#Jump(a:position, a:wrap, a:filter,
|
call ale#loclist_jumping#Jump(a:position, a:wrap, a:filter,
|
||||||
\ a:subtype_filter)
|
\ a:subtype_filter)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -104,3 +104,18 @@ Execute(We should be able to jump when the error line is blank):
|
|||||||
AssertEqual [2, 8], TestJump('before', 1, 'any', 'any', [3, 1])
|
AssertEqual [2, 8], TestJump('before', 1, 'any', 'any', [3, 1])
|
||||||
AssertEqual [3, 1], TestJump('after', 0, 'any', 'any', [3, 1])
|
AssertEqual [3, 1], TestJump('after', 0, 'any', 'any', [3, 1])
|
||||||
AssertEqual [1, 2], TestJump('after', 1, 'any', 'any', [3, 1])
|
AssertEqual [1, 2], TestJump('after', 1, 'any', 'any', [3, 1])
|
||||||
|
|
||||||
|
Execute(ALE should jump to column 1 instead of 0):
|
||||||
|
let g:ale_buffer_info = {
|
||||||
|
\ bufnr(''): {
|
||||||
|
\ 'loclist': [
|
||||||
|
\ {'type': 'E', 'bufnr': bufnr(''), 'lnum': 1, 'col': 5},
|
||||||
|
\ {'type': 'E', 'bufnr': bufnr(''), 'lnum': 2, 'col': 0},
|
||||||
|
\ ],
|
||||||
|
\ },
|
||||||
|
\}
|
||||||
|
|
||||||
|
AssertEqual [2, 1], TestJump('after', 1, 'any', 'any', [1, 5])
|
||||||
|
AssertEqual [1, 5], TestJump('after', 1, 'any', 'any', [2, 1])
|
||||||
|
AssertEqual [2, 1], TestJump('before', 1, 'any', 'any', [1, 5])
|
||||||
|
AssertEqual [1, 5], TestJump('before', 1, 'any', 'any', [2, 1])
|
||||||
|
|||||||
Reference in New Issue
Block a user