diff options
author | w0rp <w0rp@users.noreply.github.com> | 2020-11-21 16:40:29 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-21 16:40:29 +0000 |
commit | b8aaff2cf77883702374aee28f088b8a64c3b492 (patch) | |
tree | 03aa38fd18c7762734e30cb40f9170d2b6313cdb | |
parent | 342e5af4e367e225eb1c96cb0ecb4a211c2a4f8e (diff) | |
parent | 6bebdcfa30b492b7c71316b707d36c4f4d19a1f1 (diff) | |
download | ale-b8aaff2cf77883702374aee28f088b8a64c3b492.zip |
Merge pull request #3358 from lukaswozniak/master
Improves fixer performance for large buffers
-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('$') |