[patch] inner-tagblock does not account for selection=exclusive and multibyte char correctly

34 views
Skip to first unread message

Christian Brabandt

unread,
Dec 13, 2014, 8:57:45 AM12/13/14
to vim...@vim.org
Bram,
:set selection=exclusive
<tag>“hello world!”</tag>

now select the inner tagblock (vit), copy it and paste it somewhere.
You'll notice, the last (multibyte) quote, won't get copied.

Here is a patch:
--- a/src/search.c
+++ b/src/search.c
@@ -3933,7 +3933,7 @@ again:
if (lt(end_pos, start_pos))
curwin->w_cursor = start_pos;
else if (*p_sel == 'e')
- ++curwin->w_cursor.col;
+ inc_cursor();
VIsual = start_pos;
VIsual_mode = 'v';
redraw_curbuf_later(INVERTED); /* update the inversion */

This issue has been noticed at SO:
http://stackoverflow.com/questions/27445912

Best,
Christian
--
Aus Murphy's Gesetze:
Das Produkt, das du beinahe gekauft hättest, schneidet im Testbereich
am besten ab.

Bram Moolenaar

unread,
Dec 13, 2014, 2:12:06 PM12/13/14
to Christian Brabandt, vim...@vim.org

Christian wrote:

> :set selection=exclusive
> <tag>“hello world!”</tag>
>
> now select the inner tagblock (vit), copy it and paste it somewhere.
> You'll notice, the last (multibyte) quote, won't get copied.
>
> Here is a patch:
> --- a/src/search.c
> +++ b/src/search.c
> @@ -3933,7 +3933,7 @@ again:
> if (lt(end_pos, start_pos))
> curwin->w_cursor = start_pos;
> else if (*p_sel == 'e')
> - ++curwin->w_cursor.col;
> + inc_cursor();
> VIsual = start_pos;
> VIsual_mode = 'v';
> redraw_curbuf_later(INVERTED); /* update the inversion */
>
> This issue has been noticed at SO:
> http://stackoverflow.com/questions/27445912

Thanks!

--
The budget process was invented by an alien race of sadistic beings who
resemble large cats.
(Scott Adams - The Dilbert principle)

/// Bram Moolenaar -- Br...@Moolenaar.net -- 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 ///
Reply all
Reply to author
Forward
0 new messages