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 */
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);
}
endif
set belloff=all
-function! CpoM(line, useM, expected)
+func CpoM(line, useM, expected)
new
if a:useM
call assert_equal(getreg('"'), a:expected[2])
q!
-endfunction
+endfunc
-function! Test_inner_block_without_cpo_M()
+func Test_inner_block_without_cpo_M()
call CpoM('(red \(blue) green)', 0, ['red \(blue', 'red \(blue', ''])
-endfunction
+endfunc
-function! Test_inner_block_with_cpo_M_left_backslash()
+func Test_inner_block_with_cpo_M_left_backslash()
call CpoM('(red \(blue) green)', 1, ['red \(blue) green', 'blue', 'red \(blue) green'])
-endfunction
+endfunc
-function! Test_inner_block_with_cpo_M_right_backslash()
+func Test_inner_block_with_cpo_M_right_backslash()
call CpoM('(red (blue\) green)', 1, ['red (blue\) green', 'blue\', 'red (blue\) green'])
-endfunction
+endfunc
+
+func Test_quote_selection_selection_exclusive()
+ new
+ call setline(1, "a 'bcde' f")
+ set selection=exclusive
+ exe "norm! fdvhi'y"
+ call assert_equal('bcde', @")
+ set selection&vim
+ bw!
+endfunc