aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-02-02 00:55:42 +0100
committerJustin M. Keyes <justinkz@gmail.com>2018-02-11 15:27:56 +0100
commit4fe4b5abb6845b51af195e77576179ff5281451e (patch)
treede81f8fd736ee0634abcb24b4ea8985d42a654ed
parent54b9510e0572694e57d34d38e006b5e570850dea (diff)
downloadrneovim-4fe4b5abb6845b51af195e77576179ff5281451e.tar.gz
rneovim-4fe4b5abb6845b51af195e77576179ff5281451e.tar.bz2
rneovim-4fe4b5abb6845b51af195e77576179ff5281451e.zip
vim-patch:8.0.0622: selecting quoted text fails with 'selection' "exclusive"
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 vim/vim#1687) https://github.com/vim/vim/commit/c5e2b040b490c2f4dd50c945840bc176bfcccb29
-rw-r--r--src/nvim/search.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/nvim/search.c b/src/nvim/search.c
index 533a28de35..ffc81ab826 100644
--- a/src/nvim/search.c
+++ b/src/nvim/search.c
@@ -3712,7 +3712,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
if (VIsual.lnum != curwin->w_cursor.lnum) {
@@ -3720,8 +3720,17 @@ current_quote (
}
vis_bef_curs = lt(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 = equalpos(VIsual, curwin->w_cursor);
}