To: vim-dev@vim.org Subject: Patch 6.0.269 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.269 Problem: Unprintable characters in a file name may cause problems when using the 'statusline' option or when 'buftype' is "nofile". Solution: call trans_characters() for the resulting statusline. (Yasuhiro Matsumoto) Files: src/buffer.c, src/charset.c, src/screen.c *** ../vim60.268/src/buffer.c Thu Feb 21 13:59:30 2002 --- src/buffer.c Fri Feb 22 13:14:18 2002 *************** *** 3030,3037 **** t = (opt == STL_FULLPATH) ? wp->w_buffer->b_ffname : wp->w_buffer->b_fname; home_replace(wp->w_buffer, t, NameBuff, MAXPATHL, TRUE); - trans_characters(NameBuff, MAXPATHL); } if (opt != STL_FILENAME) str = NameBuff; else --- 3030,3037 ---- t = (opt == STL_FULLPATH) ? wp->w_buffer->b_ffname : wp->w_buffer->b_fname; home_replace(wp->w_buffer, t, NameBuff, MAXPATHL, TRUE); } + trans_characters(NameBuff, MAXPATHL); if (opt != STL_FILENAME) str = NameBuff; else *** ../vim60.268/src/charset.c Thu Feb 21 13:59:30 2002 --- src/charset.c Fri Feb 22 16:53:26 2002 *************** *** 274,279 **** --- 274,281 ---- return OK; } + #if defined(FEAT_TITLE) || defined(FEAT_STL_OPT) || defined(FEAT_WINDOWS) \ + || defined(PROTO) /* * Translate any special characters in buf[bufsize] in-place. * The result is a string with only printable characters, but if there is not *************** *** 293,304 **** room = bufsize - len; 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_byte(*buf); trs_len = (int)STRLEN(trs); --- 295,306 ---- room = bufsize - len; 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_byte(*buf); trs_len = (int)STRLEN(trs); *************** *** 315,320 **** --- 317,323 ---- buf += trs_len; } } + #endif #if defined(FEAT_EVAL) || defined(FEAT_TITLE) || defined(PROTO) /* *** ../vim60.268/src/screen.c Thu Feb 21 13:59:30 2002 --- src/screen.c Fri Feb 22 13:09:30 2002 *************** *** 4676,4686 **** if (buf_spname(wp->w_buffer) != NULL) STRCPY(NameBuff, buf_spname(wp->w_buffer)); else - { home_replace(wp->w_buffer, wp->w_buffer->b_fname, NameBuff, MAXPATHL, TRUE); ! trans_characters(NameBuff, MAXPATHL); ! } p = NameBuff; len = (int)STRLEN(p); --- 4681,4689 ---- if (buf_spname(wp->w_buffer) != NULL) STRCPY(NameBuff, buf_spname(wp->w_buffer)); else home_replace(wp->w_buffer, wp->w_buffer->b_fname, NameBuff, MAXPATHL, TRUE); ! trans_characters(NameBuff, MAXPATHL); p = NameBuff; len = (int)STRLEN(p); *************** *** 4948,4954 **** for (p = buf + len; p < buf + maxlen; p++) *p = fillchar; ! buf[maxlen] = 0; curattr = attr; p = buf; --- 4951,4957 ---- for (p = buf + len; p < buf + maxlen; p++) *p = fillchar; ! buf[maxlen] = NUL; curattr = attr; p = buf; *** ../vim60.268/src/version.c Fri Feb 22 20:54:34 2002 --- src/version.c Fri Feb 22 20:58:54 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 269, /**/ -- hundred-and-one symptoms of being an internet addict: 8. You spend half of the plane trip with your laptop on your lap...and your child in the overhead compartment. /// 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 ///