diff options
author | Łukasz Woźniak <lukasz.wozniak@nokia.com> | 2020-09-18 12:11:05 +0200 |
---|---|---|
committer | Łukasz Woźniak <lukasz.wozniak@nokia.com> | 2020-09-18 12:59:27 +0200 |
commit | 6bebdcfa30b492b7c71316b707d36c4f4d19a1f1 (patch) | |
tree | 3ffe6dc6006a1febccda939c2dc511dc81c8acf7 /autoload | |
parent | 08295ce17405cb5f6c80d2f726262493bfd21210 (diff) | |
download | ale-6bebdcfa30b492b7c71316b707d36c4f4d19a1f1.zip |
Improves fixer performance for large buffers
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/util.vim | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/autoload/ale/util.vim b/autoload/ale/util.vim index 1f396377..fcc03eb7 100644 --- a/autoload/ale/util.vim +++ b/autoload/ale/util.vim @@ -486,7 +486,7 @@ function! ale#util#Input(message, value) abort endfunction function! ale#util#HasBuflineApi() abort - return exists('*deletebufline') && exists('*setbufline') + return exists('*deletebufline') && exists('*appendbufline') && exists('*getpos') && exists('*setpos') endfunction " Sets buffer contents to lines @@ -507,8 +507,11 @@ function! ale#util#SetBufferContents(buffer, lines) abort " Use a Vim API for setting lines in other buffers, if available. if l:has_bufline_api - call setbufline(a:buffer, 1, l:new_lines) - call deletebufline(a:buffer, l:first_line_to_remove, '$') + let l:save_cursor = getpos('.') + call deletebufline(a:buffer, 1, '$') + call appendbufline(a:buffer, 1, l:new_lines) + call deletebufline(a:buffer, 1, 1) + call setpos('.', l:save_cursor) " Fall back on setting lines the old way, for the current buffer. else let l:old_line_length = line('$') |