To: vim-dev@vim.org Subject: Patch 6.1a.030 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1a.030 Problem: With double-byte encodings toupper() and tolower() may have wrong results. Solution: Skip double-byte characters. (Eric Long) Files: src/eval.c *** ../vim61a.029/src/eval.c Fri Feb 22 14:03:05 2002 --- src/eval.c Wed Mar 6 20:30:51 2002 *************** *** 6265,6273 **** while (*p != NUL) { #ifdef FEAT_MBYTE if (enc_utf8) { ! int c, lc, l; c = utf_ptr2char(p); lc = utf_tolower(c); --- 6265,6275 ---- while (*p != NUL) { #ifdef FEAT_MBYTE + int l; + if (enc_utf8) { ! int c, lc; c = utf_ptr2char(p); lc = utf_tolower(c); *************** *** 6277,6282 **** --- 6279,6286 ---- utf_char2bytes(lc, p); p += l; } + else if (has_mbyte && (l = (*mb_ptr2len_check)(p)) > 1) + p += l; /* skip multi-byte character */ else #endif { *************** *** 6304,6312 **** while (*p != NUL) { #ifdef FEAT_MBYTE if (enc_utf8) { ! int c, uc, l; c = utf_ptr2char(p); uc = utf_toupper(c); --- 6308,6318 ---- while (*p != NUL) { #ifdef FEAT_MBYTE + int l; + if (enc_utf8) { ! int c, uc; c = utf_ptr2char(p); uc = utf_toupper(c); *************** *** 6316,6321 **** --- 6322,6329 ---- utf_char2bytes(uc, p); p += l; } + else if (has_mbyte && (l = (*mb_ptr2len_check)(p)) > 1) + p += l; /* skip multi-byte character */ else #endif { *** ../vim61a.029/src/version.c Tue Mar 5 21:01:23 2002 --- src/version.c Wed Mar 6 20:31:59 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 30, /**/ -- hundred-and-one symptoms of being an internet addict: 166. You have been on your computer soo long that you didn't realize you had grandchildren. /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\ \\\ Project leader for A-A-P -- http://www.a-a-p.org /// \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///