Patch 7.4.1948
Problem:    Using Ctrl-A with double-byte encoding may result in garbled text.
Solution:   Skip to the start of a character. (Hirohito Higashi)
Files:      src/ops.c


*** ../vim-7.4.1947/src/ops.c   2016-06-14 21:32:23.478335624 +0200
--- src/ops.c   2016-06-20 21:19:11.777107359 +0200
***************
*** 5488,5498 ****
--- 5488,5510 ----
      {
        if (dobin)
            while (col > 0 && vim_isbdigit(ptr[col]))
+           {
                --col;
+ #ifdef FEAT_MBYTE
+               if (has_mbyte)
+                   col -= (*mb_head_off)(ptr, ptr + col);
+ #endif
+           }
  
        if (dohex)
            while (col > 0 && vim_isxdigit(ptr[col]))
+           {
                --col;
+ #ifdef FEAT_MBYTE
+               if (has_mbyte)
+                   col -= (*mb_head_off)(ptr, ptr + col);
+ #endif
+           }
  
        if (       dobin
                && dohex
***************
*** 5500,5505 ****
--- 5512,5521 ----
                    && (ptr[col] == 'X'
                        || ptr[col] == 'x')
                    && ptr[col - 1] == '0'
+ #ifdef FEAT_MBYTE
+                   && (!has_mbyte ||
+                       !(*mb_head_off)(ptr, ptr + col - 1))
+ #endif
                    && vim_isxdigit(ptr[col + 1]))))
        {
  
***************
*** 5508,5514 ****
--- 5524,5536 ----
            col = pos->col;
  
            while (col > 0 && vim_isdigit(ptr[col]))
+           {
                col--;
+ #ifdef FEAT_MBYTE
+               if (has_mbyte)
+                   col -= (*mb_head_off)(ptr, ptr + col);
+ #endif
+           }
        }
  
        if ((       dohex
***************
*** 5516,5531 ****
--- 5538,5565 ----
                && (ptr[col] == 'X'
                    || ptr[col] == 'x')
                && ptr[col - 1] == '0'
+ #ifdef FEAT_MBYTE
+               && (!has_mbyte ||
+                   !(*mb_head_off)(ptr, ptr + col - 1))
+ #endif
                && vim_isxdigit(ptr[col + 1])) ||
            (       dobin
                && col > 0
                && (ptr[col] == 'B'
                    || ptr[col] == 'b')
                && ptr[col - 1] == '0'
+ #ifdef FEAT_MBYTE
+               && (!has_mbyte ||
+                   !(*mb_head_off)(ptr, ptr + col - 1))
+ #endif
                && vim_isbdigit(ptr[col + 1])))
        {
            /* Found hexadecimal or binary number, move to its start. */
            --col;
+ #ifdef FEAT_MBYTE
+           if (has_mbyte)
+               col -= (*mb_head_off)(ptr, ptr + col);
+ #endif
        }
        else
        {
***************
*** 5537,5548 ****
            while (ptr[col] != NUL
                    && !vim_isdigit(ptr[col])
                    && !(doalp && ASCII_ISALPHA(ptr[col])))
!               ++col;
  
            while (col > 0
                    && vim_isdigit(ptr[col - 1])
                    && !(doalp && ASCII_ISALPHA(ptr[col])))
                --col;
        }
      }
  
--- 5571,5588 ----
            while (ptr[col] != NUL
                    && !vim_isdigit(ptr[col])
                    && !(doalp && ASCII_ISALPHA(ptr[col])))
!               col += MB_PTR2LEN(ptr + col);
  
            while (col > 0
                    && vim_isdigit(ptr[col - 1])
                    && !(doalp && ASCII_ISALPHA(ptr[col])))
+           {
                --col;
+ #ifdef FEAT_MBYTE
+               if (has_mbyte)
+                   col -= (*mb_head_off)(ptr, ptr + col);
+ #endif
+           }
        }
      }
  
***************
*** 5552,5565 ****
                && !vim_isdigit(ptr[col])
                && !(doalp && ASCII_ISALPHA(ptr[col])))
        {
!           ++col;
!           --length;
        }
  
        if (length == 0)
            goto theend;
  
!       if (col > pos->col && ptr[col - 1] == '-')
        {
            negative = TRUE;
            was_positive = FALSE;
--- 5592,5612 ----
                && !vim_isdigit(ptr[col])
                && !(doalp && ASCII_ISALPHA(ptr[col])))
        {
!           int mb_len = MB_PTR2LEN(ptr + col);
! 
!           col += mb_len;
!           length -= mb_len;
        }
  
        if (length == 0)
            goto theend;
  
!       if (col > pos->col && ptr[col - 1] == '-'
! #ifdef FEAT_MBYTE
!               && (!has_mbyte ||
!                   !(*mb_head_off)(ptr, ptr + col - 1))
! #endif
!          )
        {
            negative = TRUE;
            was_positive = FALSE;
***************
*** 5622,5628 ****
      }
      else
      {
!       if (col > 0 && ptr[col - 1] == '-' && !visual)
        {
            /* negative number */
            --col;
--- 5669,5680 ----
      }
      else
      {
!       if (col > 0 && ptr[col - 1] == '-'
! #ifdef FEAT_MBYTE
!               && (!has_mbyte ||
!                   !(*mb_head_off)(ptr, ptr + col - 1))
! #endif
!               && !visual)
        {
            /* negative number */
            --col;
***************
*** 6036,6043 ****
                         && (timestamp == 0 || y_ptr->y_time_set > timestamp))
        return;
  
!     for (i = 0; i < y_ptr->y_size; i++)
!       vim_free(y_ptr->y_array[i]);
      vim_free(y_ptr->y_array);
  
      if (y_read_regs == NULL)
--- 6088,6096 ----
                         && (timestamp == 0 || y_ptr->y_time_set > timestamp))
        return;
  
!     if (y_ptr->y_array != NULL)
!       for (i = 0; i < y_ptr->y_size; i++)
!           vim_free(y_ptr->y_array[i]);
      vim_free(y_ptr->y_array);
  
      if (y_read_regs == NULL)
*** ../vim-7.4.1947/src/version.c       2016-06-20 12:50:11.863811251 +0200
--- src/version.c       2016-06-20 21:21:58.559315082 +0200
***************
*** 755,756 ****
--- 755,758 ----
  {   /* Add new patch number below this line */
+ /**/
+     1948,
  /**/

-- 
Support your right to bare arms!  Wear short sleeves!

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

Raspunde prin e-mail lui