To: vim-dev@vim.org Subject: Patch 6.0.168 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.168 Problem: ":%s/\n/#/" doesn't replace at an empty line. (Bruce DeVisser) Solution: Don't skip matches after joining two lines. Files: src/ex_cmds.c *** ../vim60.167/src/ex_cmds.c Sun Feb 3 15:27:26 2002 --- src/ex_cmds.c Sun Feb 3 17:49:34 2002 *************** *** 3937,3947 **** * 4. If do_all is set, find next match. * Prevent endless loop with patterns that match empty * strings, e.g. :s/$/pat/g or :s/[a-z]* /(&)/g. */ skip: ! nmatch = -1; ! lastone = (sub_firstline[matchcol] == NUL || got_int || got_quit || !(do_all || do_again)); if (lastone || do_ask || (nmatch = vim_regexec_multi(®match, curwin, --- 3937,3948 ---- * 4. If do_all is set, find next match. * Prevent endless loop with patterns that match empty * strings, e.g. :s/$/pat/g or :s/[a-z]* /(&)/g. + * But ":s/\n/#/" is OK. */ skip: ! lastone = ((sub_firstline[matchcol] == NUL && nmatch <= 1) || got_int || got_quit || !(do_all || do_again)); + nmatch = -1; if (lastone || do_ask || (nmatch = vim_regexec_multi(®match, curwin, *** ../vim60.167/src/version.c Sun Feb 3 17:33:39 2002 --- src/version.c Sun Feb 3 17:53:11 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 168, /**/ -- In Joseph Heller's novel "Catch-22", the main character tries to get out of a war by proving he is crazy. But the mere fact he wants to get out of the war only shows he isn't crazy -- creating the original "Catch-22". /// 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 ///