To: vim-dev@vim.org Subject: Patch 6.2.051 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.2.051 Problem: When using "\=submatch(0)" in a ":s" command, line breaks become NUL characters. Solution: Change NL to CR characters, so that they become line breaks. Files: src/regexp.c *** ../vim-6.2.050/src/regexp.c Sun May 18 16:42:59 2003 --- src/regexp.c Fri Jun 27 20:21:44 2003 *************** *** 5705,5711 **** --- 5705,5727 ---- eval_result = eval_to_string(source + 2, NULL); if (eval_result != NULL) + { + for (s = eval_result; *s != NUL; ++s) + { + /* Change NL to CR, so that it becomes a line break. + * Skip over a backslashed character. */ + if (*s == NL) + *s = CR; + else if (*s == '\\' && s[1] != NUL) + ++s; + #ifdef FEAT_MBYTE + if (has_mbyte) + s += (*mb_ptr2len_check)(s) - 1; + #endif + } + dst += STRLEN(eval_result); + } reg_match = submatch_match; reg_mmatch = submatch_mmatch; *************** *** 5713,5719 **** reg_win = save_reg_win; ireg_ic = save_ireg_ic; can_f_submatch = FALSE; - } #endif } --- 5729,5734 ---- *** ../vim-6.2.050/src/version.c Sun Jul 27 14:44:09 2003 --- src/version.c Sun Jul 27 14:46:53 2003 *************** *** 632,633 **** --- 632,635 ---- { /* Add new patch number below this line */ + /**/ + 51, /**/ -- BEDEVERE: Why do you think she is a witch? SECOND VILLAGER: She turned me into a newt. BEDEVERE: A newt? SECOND VILLAGER: (After looking at himself for some time) I got better. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// 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 /// \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///