mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
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)
c5e2b040b4
This commit is contained in:
@@ -3712,7 +3712,7 @@ current_quote (
|
|||||||
int selected_quote = FALSE; /* Has quote inside selection */
|
int selected_quote = FALSE; /* Has quote inside selection */
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Correct cursor when 'selection' is exclusive */
|
// Correct cursor when 'selection' is "exclusive".
|
||||||
if (VIsual_active) {
|
if (VIsual_active) {
|
||||||
// this only works within one line
|
// this only works within one line
|
||||||
if (VIsual.lnum != curwin->w_cursor.lnum) {
|
if (VIsual.lnum != curwin->w_cursor.lnum) {
|
||||||
@@ -3720,8 +3720,17 @@ current_quote (
|
|||||||
}
|
}
|
||||||
|
|
||||||
vis_bef_curs = lt(VIsual, curwin->w_cursor);
|
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();
|
dec_cursor();
|
||||||
|
}
|
||||||
vis_empty = equalpos(VIsual, curwin->w_cursor);
|
vis_empty = equalpos(VIsual, curwin->w_cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user