summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorPete Beardmore <pete.beardmore@msn.com>2019-07-02 08:31:24 +0100
committerw0rp <w0rp@users.noreply.github.com>2019-07-02 08:31:24 +0100
commita5240009ba5ff22daad95c306f7dec372d46bda0 (patch)
treec45022bc6bbb05a38e60cdcec326b23eae411788 /autoload
parent46ab7c590404d60567fe57390607c3dc51933c0e (diff)
downloadale-a5240009ba5ff22daad95c306f7dec372d46bda0.zip
Fix incorrect re-selection (#2630)
ALE now only resets selections when needed, to prevent side effects.
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/list.vim15
1 files changed, 7 insertions, 8 deletions
diff --git a/autoload/ale/list.vim b/autoload/ale/list.vim
index 80a30216..e9f3f4ec 100644
--- a/autoload/ale/list.vim
+++ b/autoload/ale/list.vim
@@ -110,8 +110,6 @@ function! s:SetListsImpl(timer_id, buffer, loclist) abort
if s:ShouldOpen(a:buffer) && !empty(a:loclist)
let l:winnr = winnr()
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
let l:open_type = ''
@@ -133,12 +131,13 @@ function! s:SetListsImpl(timer_id, buffer, loclist) abort
wincmd p
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.
+ " Return to original mode when applicable
+ if mode() != l:mode
+ if l:mode is? 'v' || l:mode is# "\<c-v>"
+ " Reset our last visual selection
+ normal! gv
+ elseif l:mode is? 's' || l:mode is# "\<c-s>"
+ " Reset our last character selection
normal! "\<c-g>"
endif
endif