To: [email protected]
Subject: Patch 5.7a.003
Fcc: outbox
From: Bram Moolenaar <[email protected]>
------------

Patch 5.7a.003
Problem:    Multi-byte: After using CTRL-O in Insert mode with the cursor at
           the end of the line on a multi-byte character the cursor moves to
           the left.
Solution:   Check for multi-byte character at end-of-line. (Taro Muraoka)
           Also: fix cls() to detect a double-byte character. (Chong-Dae Park)
Files:      src/edit.c, src/search.c


*** ../vim-5.7a.2/src/edit.c    Wed Jun  7 12:24:52 2000
--- src/edit.c  Sat Jun 17 21:32:18 2000
***************
*** 351,359 ****
       update_curswant();
       if (       ((o_eol && curwin->w_cursor.lnum == o_lnum)
                   || curwin->w_curswant > curwin->w_virtcol)
!               && *(ptr = ml_get_curline() + curwin->w_cursor.col) != NUL
!               && *(ptr + 1) == NUL)
!           ++curwin->w_cursor.col;
     }
     else
     {
--- 351,366 ----
       update_curswant();
       if (       ((o_eol && curwin->w_cursor.lnum == o_lnum)
                   || curwin->w_curswant > curwin->w_virtcol)
!               && *(ptr = ml_get_curline() + curwin->w_cursor.col) != NUL)
!       {
!           if (ptr[1] == NUL)
!               ++curwin->w_cursor.col;
! #ifdef MULTI_BYTE
!           else if (is_dbcs && ptr[2] == NUL && IsLeadByte(ptr[0])
!                   && IsTrailByte(ptr - curwin->w_cursor.col, ptr + 1))
!               curwin->w_cursor.col += 2;
! #endif
!       }
     }
     else
     {
*** ../vim-5.7a.2/src/search.c  Sun Apr  2 11:47:17 2000
--- src/search.c        Sat Jun 17 21:48:57 2000
***************
*** 2069,2075 ****
     if (c == ' ' || c == '\t' || c == NUL)
       return 0;
 #ifdef MULTI_BYTE
!     if (is_dbcs && IsLeadByte(c))
     {
       /* process code leading/trailing bytes */
       unsigned char pcode_lb = c & 0xff;
--- 2070,2076 ----
     if (c == ' ' || c == '\t' || c == NUL)
       return 0;
 #ifdef MULTI_BYTE
!     if (is_dbcs && c > 0xff)
     {
       /* process code leading/trailing bytes */
       unsigned char pcode_lb = c & 0xff;
***************
*** 2084,2090 ****
           lb = pcode_lb;
           tb = pcode_tb;
           /* convert process code to JIS */
! #ifdef WIN32
           /* process code is SJIS */
           if (lb <= 0x9f)
               lb = (lb - 0x81) * 2 + 0x21;
--- 2085,2091 ----
           lb = pcode_lb;
           tb = pcode_tb;
           /* convert process code to JIS */
! # if defined(WIN32) || defined(macintosh)
           /* process code is SJIS */
           if (lb <= 0x9f)
               lb = (lb - 0x81) * 2 + 0x21;
***************
*** 2099,2105 ****
               tb -= 0x7e;
               lb += 1;
           }
! #else
           /*
            * XXX:  Code page identification can not use with all
            *       system! So, some other encoding information
--- 2100,2106 ----
               tb -= 0x7e;
               lb += 1;
           }
! # else
           /*
            * XXX:  Code page identification can not use with all
            *       system! So, some other encoding information
***************
*** 2112,2118 ****
           /* assume process code is JAPANESE-EUC */
           lb &= 0x7f;
           tb &= 0x7f;
! #endif
           /* exceptions */
           switch (lb << 8 | tb)
           {
--- 2113,2119 ----
           /* assume process code is JAPANESE-EUC */
           lb &= 0x7f;
           tb &= 0x7f;
! # endif
           /* exceptions */
           switch (lb << 8 | tb)
           {
*** ../vim-5.7a.2/src/version.c Sun Jun 18 15:33:53 2000
--- src/version.c       Sun Jun 18 15:34:54 2000
***************
*** 420,421 ****
--- 420,423 ----
 {   /* Add new patch number below this line */
+ /**/
+     3,
 /**/

--
hundred-and-one symptoms of being an internet addict:
50. The last girl you picked up was only a jpeg.

/-/-- Bram Moolenaar --- [email protected] --- http://www.moolenaar.net --\-\
\-\-- Vim: http://www.vim.org ---- ICCF Holland: http://www.vim.org/iccf --/-/