diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-06-05 16:37:07 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-06-05 16:37:07 +0200 |
commit | c5e2b040b490c2f4dd50c945840bc176bfcccb29 (patch) | |
tree | 6d837ebbcd51c6439deed9b3ce2b5a551c91d0a9 /src/search.c | |
parent | 8ad80dea089ffeb1a845199c013e9bb4be1cd22e (diff) | |
download | vim-git-c5e2b040b490c2f4dd50c945840bc176bfcccb29.tar.gz |
patch 8.0.0622: selecting quoted text fails with 'selection' "exclusive"v8.0.0622
Problem: Using a text object to select quoted text fails when 'selection'
is set to "exclusive". (Guraga)
Solution: Swap cursor and visual start position. (Christian Brabandt,
closes #1687)
Diffstat (limited to 'src/search.c')
-rw-r--r-- | src/search.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/search.c b/src/search.c index bd5d08c34..c1197160a 100644 --- a/src/search.c +++ b/src/search.c @@ -4364,7 +4364,7 @@ current_quote( int selected_quote = FALSE; /* Has quote inside selection */ int i; - /* Correct cursor when 'selection' is exclusive */ + /* Correct cursor when 'selection' is "exclusive". */ if (VIsual_active) { /* this only works within one line */ @@ -4372,8 +4372,19 @@ current_quote( return FALSE; vis_bef_curs = LT_POS(VIsual, curwin->w_cursor); - if (*p_sel == 'e' && vis_bef_curs) + if (*p_sel == 'e') + { + if (!vis_bef_curs) + { + /* VIsual needs to be start of Visual selection. */ + pos_T t = curwin->w_cursor; + + curwin->w_cursor = VIsual; + VIsual = t; + vis_bef_curs = TRUE; + } dec_cursor(); + } vis_empty = EQUAL_POS(VIsual, curwin->w_cursor); } |