summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kocis <adrian.kocis@gmail.com>2017-08-07 22:57:59 +0200
committerw0rp <w0rp@users.noreply.github.com>2017-08-07 21:57:59 +0100
commitc18451fba9b96efeb6da2cf72bc1214bfd821c3a (patch)
treef9f1766510144600f5e22660053f2d9e41c5fb0c
parent2c4700ab7f8707b88ce05342b8b2e845ee8c67db (diff)
downloadale-c18451fba9b96efeb6da2cf72bc1214bfd821c3a.zip
added missing visual reselection after quick/location list update (#788)
Reset visual selection after opening loclist or quickfix windows
-rw-r--r--autoload/ale/list.vim15
1 files changed, 15 insertions, 0 deletions
diff --git a/autoload/ale/list.vim b/autoload/ale/list.vim
index 9fe35bf3..3de6adbf 100644
--- a/autoload/ale/list.vim
+++ b/autoload/ale/list.vim
@@ -39,6 +39,14 @@ function! ale#list#SetLists(buffer, loclist) abort
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() ==# "\<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 !ale#list#IsQuickfixOpen()
execute 'copen ' . str2nr(ale#Var(a:buffer, 'list_window_size'))
@@ -51,6 +59,13 @@ function! ale#list#SetLists(buffer, loclist) abort
if l:winnr !=# winnr()
wincmd p
endif
+
+ if l:reset_visual_selection || l:reset_character_selection
+ normal! gv
+ if l:reset_character_selection
+ normal! "\<c-g>"
+ endif
+ endif
endif
endfunction