To: vim-dev@vim.org Subject: Patch 5.6.017 Fcc: outbox From: Bram Moolenaar ------------ Patch 5.6.017 Problem: ":s/e/\^M/" should replace an "e" with a CTRL-M, not split the line. (Calder) Solution: Replace the backslash with a CTRL-V internally. (Stephen P. Wall) Files: src/ex_cmds.c *** ../vim-5.6.16/src/ex_cmds.c Fri Dec 24 12:15:29 1999 --- src/ex_cmds.c Sat Mar 25 13:06:08 2000 *************** *** 3055,3061 **** --- 3055,3066 ---- break; } if (cmd[0] == '\\' && cmd[1] != 0) /* skip escaped characters */ + { + /* Change "\^M" to "^V^M" to avoid a line split below */ + if (cmd[1] == CR) + cmd[0] = Ctrl('V'); ++cmd; + } ++cmd; } *************** *** 3362,3370 **** /* * Now the trick is to replace CTRL-Ms with a real line break. * This would make it impossible to insert CTRL-Ms in the text. ! * That is the way vi works. In Vim the line break can be ! * avoided by preceding the CTRL-M with a CTRL-V. Now you can't ! * precede a line break with a CTRL-V, big deal. */ while ((p1 = vim_strchr(new_end, CR)) != NULL) { --- 3367,3376 ---- /* * Now the trick is to replace CTRL-Ms with a real line break. * This would make it impossible to insert CTRL-Ms in the text. ! * The line break can be avoided by preceding the CTRL-M with ! * a CTRL-V. Now you can't precede a line break with a CTRL-V. ! * Above "\^M" is replaced with "^V^M", so that a backslash ! * can also be used to escape the CTRL-M (Vi compatible). */ while ((p1 = vim_strchr(new_end, CR)) != NULL) { *** ../vim-5.6.16/src/version.c Sat Mar 25 13:10:19 2000 --- src/version.c Sat Mar 25 13:10:00 2000 *************** *** 420,421 **** --- 420,423 ---- { /* Add new patch number below this line */ + /**/ + 17, /**/ -- If I tell you "you have a beautiful body", would you hold it against me? /-/-- Bram Moolenaar --- Bram@moolenaar.net --- http://www.moolenaar.net --\-\ \-\-- Vim: http://www.vim.org ---- ICCF Holland: http://www.vim.org/iccf --/-/