diff options
author | w0rp <devw0rp@gmail.com> | 2018-04-08 17:17:30 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2018-04-08 17:17:46 +0100 |
commit | 91d7e81ebc08581fc0339c939c0adecaa590f2f7 (patch) | |
tree | 3773dfccbeb678de38c75923e30654f7e67711e2 /autoload/ale/engine.vim | |
parent | 121e806423830fa9e6bc1c7833f0624bd06903ff (diff) | |
download | ale-91d7e81ebc08581fc0339c939c0adecaa590f2f7.zip |
Fix #605 - Support `vcol: 1` for multi-byte character positions
Diffstat (limited to 'autoload/ale/engine.vim')
-rw-r--r-- | autoload/ale/engine.vim | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/autoload/ale/engine.vim b/autoload/ale/engine.vim index dd871c36..0704fd5b 100644 --- a/autoload/ale/engine.vim +++ b/autoload/ale/engine.vim @@ -393,7 +393,7 @@ function! ale#engine#FixLocList(buffer, linter_name, loclist) abort \ 'text': l:old_item.text, \ 'lnum': str2nr(l:old_item.lnum), \ 'col': str2nr(get(l:old_item, 'col', 0)), - \ 'vcol': get(l:old_item, 'vcol', 0), + \ 'vcol': 0, \ 'type': get(l:old_item, 'type', 'E'), \ 'nr': get(l:old_item, 'nr', -1), \ 'linter_name': a:linter_name, @@ -453,6 +453,20 @@ function! ale#engine#FixLocList(buffer, linter_name, loclist) abort " When errors go beyond the end of the file, put them at the end. " This is only done for the current buffer. let l:item.lnum = l:last_line_number + elseif get(l:old_item, 'vcol', 0) + " Convert virtual column positions to byte positions. + " The positions will be off if the buffer has changed recently. + let l:line = getbufline(a:buffer, l:item.lnum)[0] + + let l:item.col = ale#util#Col(l:line, l:item.col) + + if has_key(l:item, 'end_col') + let l:end_line = get(l:item, 'end_lnum', l:line) != l:line + \ ? getbufline(a:buffer, l:item.end_lnum)[0] + \ : l:line + + let l:item.end_col = ale#util#Col(l:end_line, l:item.end_col) + endif endif call add(l:new_loclist, l:item) |