Hi Bram and Christian,

2014/10/10(Fri) 22:34:57 UTC+9 Bram Moolenaar:
> Patch 7.4.473
> Problem:    Cursor movement is incorrect when there is a number
>           column/sign/fold column and 'sbr' is displayed.
> Solution:   Adjust the column for 'sbr'. (Christian Brabandt)
> Files:            src/charset.c
>
>
> *** ../vim-7.4.472/src/charset.c      2014-08-24 21:19:22.224571318 +0200
> --- src/charset.c     2014-10-10 15:24:26.257091676 +0200
> ***************
> *** 1184,1189 ****
> --- 1184,1191 ----
>       {
>           col -= W_WIDTH(wp);
>           numberextra = W_WIDTH(wp) - (numberextra - win_col_off2(wp));
> +         if (*p_sbr != NUL && col >= (colnr_T)STRLEN(p_sbr))
> +             col -= (colnr_T)STRLEN(p_sbr);
>           if (numberextra > 0)
>               col = col % numberextra;
>       }
> *** ../vim-7.4.472/src/version.c      2014-10-10 15:28:41.985092234 +0200
> --- src/version.c     2014-10-10 15:32:19.029092709 +0200
> ***************
> *** 743,744 ****
> --- 743,746 ----
>   {   /* Add new patch number below this line */
> + /**/
> +     473,
>   /**/

I got the bug reports about cursor movement related to 'sbr' options.

How to reproduce:
- start Vim 7.4.473 or later. (with columns less than equal 80)
  $ vim -N -u NONE -c "se sbr=----"

- Input below.
  200aa<Esc>g0

Expected behavior:
- Cursor move to first 'a' of this line.

Actual behavior:
- Cursor move to the show-break character.


Investigation result:
Patch 7.4.473 is different from the original Christian's patch.

Patch 7.4.473
https://groups.google.com/d/msg/vim_dev/PT5NYPU_jIE/K6UF_2PEdHQJ
(Added the code to above line of "if (numberextra > 0)".)

Christian's patch (The latter part)
https://groups.google.com/d/msg/vim_dev/oX0ZyQfoem8/gkqq8hZjdioJ
(Added the code to blow line of "if (numberextra > 0)".)

I think Christian's patch is right.

I attached a patch.
NOTE: Patch author is Hiroyuki Takagi.

--
Best regards,
Hirohito Higashi

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
diff -r 8bb4ca7fba40 src/charset.c
--- a/src/charset.c	Wed Oct 22 22:09:01 2014 +0200
+++ b/src/charset.c	Mon Oct 27 00:06:58 2014 +0900
@@ -1184,14 +1184,14 @@
 	{
 	    col -= W_WIDTH(wp);
 	    numberextra = W_WIDTH(wp) - (numberextra - win_col_off2(wp));
+	    if (numberextra > 0)
+		col %= numberextra;
 	    if (*p_sbr != NUL)
 	    {
 		colnr_T sbrlen = (colnr_T)MB_CHARLEN(p_sbr);
 		if (col >= sbrlen)
 		    col -= sbrlen;
 	    }
-	    if (numberextra > 0)
-		col = col % numberextra;
 	}
 	if (col == 0 || col + size > (colnr_T)W_WIDTH(wp))
 	{

Raspunde prin e-mail lui