To: vim-dev@vim.org Subject: Patch 6.1.041 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.041 Problem: ":mkvimrc" doesn't handle a mapping that has a leading space in the rhs. (Davyd Ondrejko) Solution: Insert a CTRL-V before the leading space. Also display leading and trailing white space in <> form. Files: src/getchar.c, src/message.c *** ../vim61.040/src/getchar.c Tue Apr 23 22:22:00 2002 --- src/getchar.c Mon Apr 29 22:53:52 2002 *************** *** 4051,4061 **** * return FAIL for failure, OK otherwise */ int ! put_escstr(fd, str, what) FILE *fd; ! char_u *str; int what; { int c; int modifiers; --- 4051,4062 ---- * return FAIL for failure, OK otherwise */ int ! put_escstr(fd, strstart, what) FILE *fd; ! char_u *strstart; int what; { + char_u *str = strstart; int c; int modifiers; *************** *** 4136,4141 **** --- 4137,4144 ---- * prevent them from misinterpreted in DoOneCmd(). * A space, Tab and '"' has to be escaped with a backslash to * prevent it to be misinterpreted in do_set(). + * A space has to be escaped with a CTRL-V when it's at the start of a + * ":map" rhs. * A '<' has to be escaped with a CTRL-V to prevent it being * interpreted as the start of a special key name. * A space in the lhs of a :map needs a CTRL-V. *************** *** 4145,4152 **** if (putc('\\', fd) < 0) return FAIL; } ! else if (c < ' ' || c > '~' || c == '|' || (what != 2 && c == '<') ! || (what == 0 && c == ' ')) { if (putc(Ctrl_V, fd) < 0) return FAIL; --- 4148,4157 ---- if (putc('\\', fd) < 0) return FAIL; } ! else if (c < ' ' || c > '~' || c == '|' ! || (what == 0 && c == ' ') ! || (what == 1 && str == strstart && c == ' ') ! || (what != 2 && c == '<')) { if (putc(Ctrl_V, fd) < 0) return FAIL; *** ../vim61.040/src/message.c Fri Mar 15 21:36:35 2002 --- src/message.c Mon Apr 29 22:56:26 2002 *************** *** 1162,1171 **** * the character/string -- webb */ int ! msg_outtrans_special(str, from) ! char_u *str; int from; /* TRUE for lhs of a mapping */ { int retval = 0; char_u *string; int attr; --- 1162,1172 ---- * the character/string -- webb */ int ! msg_outtrans_special(strstart, from) ! char_u *strstart; int from; /* TRUE for lhs of a mapping */ { + char_u *str = strstart; int retval = 0; char_u *string; int attr; *************** *** 1174,1180 **** attr = hl_attr(HLF_8); while (*str != NUL) { ! string = str2special(&str, from); len = vim_strsize(string); /* Highlight special keys */ msg_puts_attr(string, len > 1 --- 1175,1188 ---- attr = hl_attr(HLF_8); while (*str != NUL) { ! /* Leading and trailing spaces need to be displayed in <> form. */ ! if ((str == strstart || str[1] == NUL) && *str == ' ') ! { ! string = (char_u *)""; ! ++str; ! } ! else ! string = str2special(&str, from); len = vim_strsize(string); /* Highlight special keys */ msg_puts_attr(string, len > 1 *** ../vim61.040/src/version.c Mon Apr 29 21:59:52 2002 --- src/version.c Mon Apr 29 22:50:28 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 41, /**/ -- It's not hard to meet expenses, they're everywhere. /// 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 ///