From 2edea153585560e5788d1761595eb0141ad6e3bd Mon Sep 17 00:00:00 2001 From: w0rp Date: Mon, 7 Aug 2017 22:08:35 +0100 Subject: [PATCH] Fix the resetting of selections and annotate it --- autoload/ale/list.vim | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/autoload/ale/list.vim b/autoload/ale/list.vim index 3de6adbf..6186d863 100644 --- a/autoload/ale/list.vim +++ b/autoload/ale/list.vim @@ -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 (g:ale_open_list && !empty(a:loclist)) || g:ale_keep_list_window_open let l:winnr = winnr() - - let l:reset_visual_selection = 0 - let l:reset_character_selection = 0 - if mode() ==? 'v' || mode() ==# "\" - let l:reset_visual_selection = 1 - elseif mode() ==? 's' || mode() ==# "\" - let l:reset_character_selection = 1 - endif + let l:mode = mode() + let l:reset_visual_selection = l:mode ==? 'v' || l:mode ==# "\" + let l:reset_character_selection = l:mode ==? 's' || l:mode ==# "\" if g:ale_set_quickfix if !ale#list#IsQuickfixOpen() @@ -61,8 +56,11 @@ function! ale#list#SetLists(buffer, loclist) abort endif if l:reset_visual_selection || l:reset_character_selection + " If we were in a selection mode before, select the last selection. normal! gv + if l:reset_character_selection + " Switch back to Select mode, if we were in that. normal! "\" endif endif