Patch 8.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)
Files: src/search.c, src/testdir/test_textobjects.vim
*** ../vim-8.0.0621/src/search.c 2017-06-05 16:01:53.921848195 +0200
--- src/search.c 2017-06-05 16:36:41.095617546 +0200
***************
*** 4364,4370 ****
int selected_quote = FALSE; /* Has quote inside selection */
int i;
! /* Correct cursor when 'selection' is exclusive */
if (VIsual_active)
{
/* this only works within one line */
--- 4364,4370 ----
int selected_quote = FALSE; /* Has quote inside selection */
int i;
! /* Correct cursor when 'selection' is "exclusive". */
if (VIsual_active)
{
/* this only works within one line */
***************
*** 4372,4379 ****
return FALSE;
vis_bef_curs = LT_POS(VIsual, curwin->w_cursor);
! if (*p_sel == 'e' && vis_bef_curs)
dec_cursor();
vis_empty = EQUAL_POS(VIsual, curwin->w_cursor);
}
--- 4372,4390 ----
return FALSE;
vis_bef_curs = LT_POS(VIsual, curwin->w_cursor);
! 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);
}
*** ../vim-8.0.0621/src/testdir/test_textobjects.vim 2017-03-08
22:55:14.914181221 +0100
--- src/testdir/test_textobjects.vim 2017-06-05 16:24:31.120615609 +0200
***************
*** 5,11 ****
endif
set belloff=all
! function! CpoM(line, useM, expected)
new
if a:useM
--- 5,11 ----
endif
set belloff=all
! func CpoM(line, useM, expected)
new
if a:useM
***************
*** 29,44 ****
call assert_equal(getreg('"'), a:expected[2])
q!
! endfunction
! function! Test_inner_block_without_cpo_M()
call CpoM('(red \(blue) green)', 0, ['red \(blue', 'red \(blue', ''])
! endfunction
! function! Test_inner_block_with_cpo_M_left_backslash()
call CpoM('(red \(blue) green)', 1, ['red \(blue) green', 'blue', 'red
\(blue) green'])
! endfunction
! function! Test_inner_block_with_cpo_M_right_backslash()
call CpoM('(red (blue\) green)', 1, ['red (blue\) green', 'blue\', 'red
(blue\) green'])
! endfunction
--- 29,54 ----
call assert_equal(getreg('"'), a:expected[2])
q!
! endfunc
! func Test_inner_block_without_cpo_M()
call CpoM('(red \(blue) green)', 0, ['red \(blue', 'red \(blue', ''])
! endfunc
! func Test_inner_block_with_cpo_M_left_backslash()
call CpoM('(red \(blue) green)', 1, ['red \(blue) green', 'blue', 'red
\(blue) green'])
! endfunc
! func Test_inner_block_with_cpo_M_right_backslash()
call CpoM('(red (blue\) green)', 1, ['red (blue\) green', 'blue\', 'red
(blue\) green'])
! 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
*** ../vim-8.0.0621/src/version.c 2017-06-05 16:01:53.921848195 +0200
--- src/version.c 2017-06-05 16:35:26.860126461 +0200
***************
*** 766,767 ****
--- 766,769 ----
{ /* Add new patch number below this line */
+ /**/
+ 622,
/**/
--
Everybody wants to go to heaven, but nobody wants to die.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.