Fix the resetting of selections and annotate it

This commit is contained in:
w0rp 2017-08-07 22:08:35 +01:00
parent c18451fba9
commit 2edea15358

View File

@ -38,14 +38,9 @@ function! ale#list#SetLists(buffer, loclist) abort
" If we have errors in our list, open the list. Only if it isn't already open " If we have errors in our list, open the list. Only if it isn't already open
if (g:ale_open_list && !empty(a:loclist)) || g:ale_keep_list_window_open if (g:ale_open_list && !empty(a:loclist)) || g:ale_keep_list_window_open
let l:winnr = winnr() let l:winnr = winnr()
let l:mode = mode()
let l:reset_visual_selection = 0 let l:reset_visual_selection = l:mode ==? 'v' || l:mode ==# "\<c-v>"
let l:reset_character_selection = 0 let l:reset_character_selection = l:mode ==? 's' || l:mode ==# "\<c-s>"
if mode() ==? 'v' || mode() ==# "\<c-v>"
let l:reset_visual_selection = 1
elseif mode() ==? 's' || mode() ==# "\<c-s>"
let l:reset_character_selection = 1
endif
if g:ale_set_quickfix if g:ale_set_quickfix
if !ale#list#IsQuickfixOpen() if !ale#list#IsQuickfixOpen()
@ -61,8 +56,11 @@ function! ale#list#SetLists(buffer, loclist) abort
endif endif
if l:reset_visual_selection || l:reset_character_selection if l:reset_visual_selection || l:reset_character_selection
" If we were in a selection mode before, select the last selection.
normal! gv normal! gv
if l:reset_character_selection if l:reset_character_selection
" Switch back to Select mode, if we were in that.
normal! "\<c-g>" normal! "\<c-g>"
endif endif
endif endif