To: vim-dev@vim.org Subject: Patch 6.0.213 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.213 Problem: When a file name contains unprintable characters, CTRL-G and other commands don't work well. Solution: Turn unprintable into printable characters. (Yasuhiro Matsumoto) Files: src/buffer.c, src/charset.c *** ../vim60.212/src/buffer.c Tue Jan 22 14:22:37 2002 --- src/buffer.c Fri Feb 8 11:34:32 2002 *************** *** 2490,2495 **** --- 2490,2498 ---- name = curbuf->b_ffname; home_replace(shorthelp ? curbuf : NULL, name, p, (int)(IOSIZE - (p - buffer)), TRUE); + /* the file name may contain unprintable characters, esp. when using + * multi-byte chars */ + trans_characters(buffer, IOSIZE); } sprintf((char *)buffer + STRLEN(buffer), *** ../vim60.212/src/charset.c Fri Jan 25 10:05:09 2002 --- src/charset.c Sun Feb 10 13:20:31 2002 *************** *** 274,280 **** return OK; } - #if defined(FEAT_STL_OPT) || defined(FEAT_WINDOWS) || defined(PROTO) /* * Translate any special characters in buf[bufsize] in-place. * If there is not enough room, not all characters will be translated. --- 274,279 ---- *************** *** 294,306 **** while (*buf != 0) { #ifdef FEAT_MBYTE /* Assume a multi-byte character doesn't need translation. */ if (has_mbyte && (trs_len = (*mb_ptr2len_check)(buf)) > 1) len -= trs_len; else #endif { ! trs = transchar(*buf); trs_len = (int)STRLEN(trs); if (trs_len > 1) { --- 293,316 ---- while (*buf != 0) { #ifdef FEAT_MBYTE + char bstr[7]; + /* Assume a multi-byte character doesn't need translation. */ if (has_mbyte && (trs_len = (*mb_ptr2len_check)(buf)) > 1) len -= trs_len; else #endif { ! #ifdef FEAT_MBYTE ! /* catch illegal UTF-8 byte */ ! if (enc_utf8 && *buf >= 0x80) ! { ! transchar_nonprint(bstr, *buf); ! trs = bstr; ! } ! else ! #endif ! trs = transchar(*buf); trs_len = (int)STRLEN(trs); if (trs_len > 1) { *************** *** 315,321 **** buf += trs_len; } } - #endif #if defined(FEAT_EVAL) || defined(FEAT_TITLE) || defined(PROTO) /* --- 325,330 ---- *** ../vim60.212/src/version.c Mon Feb 11 14:04:44 2002 --- src/version.c Mon Feb 11 14:07:40 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 213, /**/ -- A computer programmer is a device for turning requirements into undocumented features. It runs on cola, pizza and Dilbert cartoons. Bram Moolenaar /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim ))) \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///