Fix incorrect re-selection (#2630)

ALE now only resets selections when needed, to prevent side effects.
This commit is contained in:
Pete Beardmore 2019-07-02 08:31:24 +01:00 committed by w0rp
parent 46ab7c5904
commit a5240009ba

View file

@ -110,8 +110,6 @@ function! s:SetListsImpl(timer_id, buffer, loclist) abort
if s:ShouldOpen(a:buffer) && !empty(a:loclist) if s:ShouldOpen(a:buffer) && !empty(a:loclist)
let l:winnr = winnr() let l:winnr = winnr()
let l:mode = mode() let l:mode = mode()
let l:reset_visual_selection = l:mode is? 'v' || l:mode is# "\<c-v>"
let l:reset_character_selection = l:mode is? 's' || l:mode is# "\<c-s>"
" open windows vertically instead of default horizontally " open windows vertically instead of default horizontally
let l:open_type = '' let l:open_type = ''
@ -133,12 +131,13 @@ function! s:SetListsImpl(timer_id, buffer, loclist) abort
wincmd p wincmd p
endif endif
if l:reset_visual_selection || l:reset_character_selection " Return to original mode when applicable
" If we were in a selection mode before, select the last selection. if mode() != l:mode
normal! gv if l:mode is? 'v' || l:mode is# "\<c-v>"
" Reset our last visual selection
if l:reset_character_selection normal! gv
" Switch back to Select mode, if we were in that. elseif l:mode is? 's' || l:mode is# "\<c-s>"
" Reset our last character selection
normal! "\<c-g>" normal! "\<c-g>"
endif endif
endif endif