On Mar 20, 2015, at 23:59, Bram Moolenaar <[email protected]> wrote:


Patch 7.4.665
Problem:    'linebreak' does not work properly with multi-byte characters.
Solution:   Compute the pointer offset with mb_head_off().  (Yasuhiro
   Matsumoto)
Files:    src/screen.c


Hi list,

With this patch, I got the following compiler warning:

screen.c:4510:11: warning: declaration shadows a local variable [-Wshadow]
                    int off = has_mbyte ? (*mb_head_off)(line, ptr - 1) : 0;
                        ^
screen.c:2886:14: note: previous declaration is here
    unsigned    off;                    /* offset in ScreenLines/ScreenAttrs */
                ^

I guess someone has already noticed it and is going to fix it.  Nonetheless, I’m attaching a tiny patch to this email to clarify what I’m talking about :-)

Note that the patch was made against screen.c of 7.4.670, not that of 7.4.665.

Regards,
Kazunobu Kuriyama

--
--
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.

Attachment: screen.c.patch
Description: Binary data



*** ../vim-7.4.664/src/screen.c 2015-03-20 15:42:07.200377381 +0100
--- src/screen.c 2015-03-20 15:51:46.173856852 +0100
***************
*** 4484,4494 ****
  */
  if (wp->w_p_lbr && vim_isbreak(c) && !vim_isbreak(*ptr))
  {
     char_u *p = ptr - (
 # ifdef FEAT_MBYTE
! has_mbyte ? mb_l :
 # endif
  1);
     /* TODO: is passing p for start of the line OK? */
     n_extra = win_lbr_chartabsize(wp, line, p, (colnr_T)vcol,
     NULL) - 1;
--- 4484,4498 ----
  */
  if (wp->w_p_lbr && vim_isbreak(c) && !vim_isbreak(*ptr))
  {
+ # ifdef FEAT_MBYTE
+    int off = has_mbyte ? (*mb_head_off)(line, ptr - 1) : 0;
+ # endif
     char_u *p = ptr - (
 # ifdef FEAT_MBYTE
! off +
 # endif
  1);
+
     /* TODO: is passing p for start of the line OK? */
     n_extra = win_lbr_chartabsize(wp, line, p, (colnr_T)vcol,
     NULL) - 1;
***************
*** 4496,4502 ****
--- 4500,4510 ----
  n_extra = (int)wp->w_buffer->b_p_ts
        - vcol % (int)wp->w_buffer->b_p_ts - 1;

+ # ifdef FEAT_MBYTE
+    c_extra = off > 0 ? MB_FILLER_CHAR : ' ';
+ # else
     c_extra = ' ';
+ # endif
     if (vim_iswhite(c))
     {
 #ifdef FEAT_CONCEAL
*** ../vim-7.4.664/src/version.c 2015-03-20 15:42:07.200377381 +0100
--- src/version.c 2015-03-20 15:47:29.472744102 +0100
***************
*** 743,744 ****
--- 743,746 ----
 {   /* Add new patch number below this line */
+ /**/
+     665,
 /**/

--
ARTHUR:  Be quiet!
DENNIS:  Well you can't expect to wield supreme executive power just 'cause
        some watery tart threw a sword at you!
ARTHUR:  Shut up!
DENNIS:  I mean, if I went around sayin' I was an empereror just because some
        moistened bint had lobbed a scimitar at me they'd put me away!
                                 The Quest for the Holy Grail (Monty Python)

/// 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.

--
--
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.

Raspunde prin e-mail lui