To: vim-dev@vim.org Subject: Patch 6.0.267 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.267 Problem: UTF-8: Although 'isprint' says a character is printable, utf_char2cells() still considers it unprintable. Solution: Use vim_isprintc() for characters upto 0x100. (Yasuhiro Matsumoto) Files: src/mbyte.c *** ../vim60.266/src/mbyte.c Fri Feb 22 17:03:56 2002 --- src/mbyte.c Fri Feb 22 20:47:59 2002 *************** *** 914,929 **** /* * For UTF-8 character "c" return 2 for a double-width character, 1 for others. */ int utf_char2cells(c) int c; { ! if (c <= 0x9f && c >= 0x80) /* unprintable, displays */ ! return 4; ! if (c >= 0x100 && !utf_printable(c)) ! return 6; /* unprintable, displays */ ! if (c >= 0x1100 && (c <= 0x115f /* Hangul Jamo */ || (c >= 0x2e80 && c <= 0xa4cf && (c & ~0x0011) != 0x300a && c != 0x303f) /* CJK ... Yi */ --- 914,931 ---- /* * For UTF-8 character "c" return 2 for a double-width character, 1 for others. + * Returns 4 or 6 for an unprintable character. + * Is only correct for characters >= 0x80. */ int utf_char2cells(c) int c; { ! if (c >= 0x100) ! { ! if (!utf_printable(c)) ! return 6; /* unprintable, displays */ ! if (c >= 0x1100 && (c <= 0x115f /* Hangul Jamo */ || (c >= 0x2e80 && c <= 0xa4cf && (c & ~0x0011) != 0x300a && c != 0x303f) /* CJK ... Yi */ *************** *** 934,940 **** || (c >= 0xff00 && c <= 0xff5f) /* Fullwidth Forms */ || (c >= 0xffe0 && c <= 0xffe6) || (c >= 0x20000 && c <= 0x2ffff))) ! return 2; return 1; } --- 936,948 ---- || (c >= 0xff00 && c <= 0xff5f) /* Fullwidth Forms */ || (c >= 0xffe0 && c <= 0xffe6) || (c >= 0x20000 && c <= 0x2ffff))) ! return 2; ! } ! ! /* Characters below 0x100 are influenced by 'isprint' option */ ! else if (!vim_isprintc(c)) ! return 4; /* unprintable, displays */ ! return 1; } *** ../vim60.266/src/version.c Fri Feb 22 20:33:16 2002 --- src/version.c Fri Feb 22 20:44:12 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 267, /**/ -- hundred-and-one symptoms of being an internet addict: 5. You find yourself brainstorming for new subjects to search. /// 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 ///