To: vim-dev@vim.org Subject: Patch 6.1.268 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.268 Problem: When triggering an abbreviation with a multi-byte character, this character is not correctly inserted after expanding the abbreviation. (Taro Muraoka) Solution: Add ABBR_OFF to all characters above 0xff. Files: src/edit.c, src/ex_getln.c, src/getchar.c *** ../vim61.267/src/edit.c Sun Oct 27 14:40:49 2002 --- src/edit.c Sun Dec 29 13:03:22 2002 *************** *** 1240,1246 **** Insstart_blank_vcol = get_nolist_virtcol(); } ! if (vim_iswordc(c) || !echeck_abbr(c)) { insert_special(c, FALSE, FALSE); #ifdef FEAT_RIGHTLEFT --- 1240,1252 ---- Insstart_blank_vcol = get_nolist_virtcol(); } ! if (vim_iswordc(c) || !echeck_abbr( ! #ifdef FEAT_MBYTE ! /* Add ABBR_OFF for characters above 0x100, this is ! * what check_abbr() expects. */ ! (has_mbyte && c >= 0x100) ? (c + ABBR_OFF) : ! #endif ! c)) { insert_special(c, FALSE, FALSE); #ifdef FEAT_RIGHTLEFT *** ../vim61.267/src/ex_getln.c Mon Oct 14 20:18:19 2002 --- src/ex_getln.c Sun Dec 29 13:06:07 2002 *************** *** 1341,1347 **** * We come here if we have a normal character. */ ! if (do_abbr && (IS_SPECIAL(c) || !vim_iswordc(c)) && ccheck_abbr(c)) goto cmdline_changed; /* --- 1341,1353 ---- * We come here if we have a normal character. */ ! if (do_abbr && (IS_SPECIAL(c) || !vim_iswordc(c)) && ccheck_abbr( ! #ifdef FEAT_MBYTE ! /* Add ABBR_OFF for characters above 0x100, this is ! * what check_abbr() expects. */ ! (has_mbyte && c >= 0x100) ? (c + ABBR_OFF) : ! #endif ! c)) goto cmdline_changed; /* *** ../vim61.267/src/getchar.c Tue Nov 19 13:53:29 2002 --- src/getchar.c Sun Dec 29 13:00:50 2002 *************** *** 3727,3733 **** /* * Check for an abbreviation. * Cursor is at ptr[col]. When inserting, mincol is where insert started. ! * "c" is the character typed before check_abbr was called. * * Historic vi practice: The last character of an abbreviation must be an id * character ([a-zA-Z0-9_]). The characters in front of it must be all id --- 3727,3734 ---- /* * Check for an abbreviation. * Cursor is at ptr[col]. When inserting, mincol is where insert started. ! * "c" is the character typed before check_abbr was called. It may have ! * ABBR_OFF added to avoid prepending a CTRL-V to it. * * Historic vi practice: The last character of an abbreviation must be an id * character ([a-zA-Z0-9_]). The characters in front of it must be all id *************** *** 3879,3885 **** --- 3880,3891 ---- tb[j++] = Ctrl_V; /* special char needs CTRL-V */ #ifdef FEAT_MBYTE if (has_mbyte) + { + /* if ABBR_OFF has been added, remove it here */ + if (c >= ABBR_OFF) + c -= ABBR_OFF; j += (*mb_char2bytes)(c, tb + j); + } else #endif tb[j++] = c; *** ../vim61.267/src/version.c Sat Dec 28 17:33:31 2002 --- src/version.c Thu Jan 2 21:05:23 2003 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 268, /**/ -- This is an airconditioned room, do not open Windows. /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ /// Creator of Vim - Vi IMproved -- http://www.vim.org \\\ \\\ Project leader for A-A-P -- http://www.a-a-p.org /// \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///