To: vim_dev@googlegroups.com Subject: Patch 7.4.2356 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.2356 Problem: Reading past end of line when using previous substitute pattern. (Dominique Pelle) Solution: Don't set "pat" only set "searchstr". Files: src/search.c, src/testdir/test_search.vim *** ../vim-7.4.2355/src/search.c 2016-09-01 20:58:17.640011363 +0200 --- src/search.c 2016-09-09 21:20:55.383530044 +0200 *************** *** 1240,1253 **** { if (spats[RE_SEARCH].pat == NULL) /* no previous pattern */ { ! pat = spats[RE_SUBST].pat; ! if (pat == NULL) { EMSG(_(e_noprevre)); retval = 0; goto end_do_search; } - searchstr = pat; } else { --- 1240,1252 ---- { if (spats[RE_SEARCH].pat == NULL) /* no previous pattern */ { ! searchstr = spats[RE_SUBST].pat; ! if (searchstr == NULL) { EMSG(_(e_noprevre)); retval = 0; goto end_do_search; } } else { *** ../vim-7.4.2355/src/testdir/test_search.vim 2016-09-03 21:04:54.993247355 +0200 --- src/testdir/test_search.vim 2016-09-09 21:20:43.283693655 +0200 *************** *** 268,270 **** --- 268,281 ---- call test_disable_char_avail(0) bw! endfunc + + func Test_use_sub_pat() + split + let @/ = '' + func X() + s/^/a/ + / + endfunc + call X() + bwipe! + endfunc *** ../vim-7.4.2355/src/version.c 2016-09-09 20:29:46.661076183 +0200 --- src/version.c 2016-09-09 21:21:48.298814469 +0200 *************** *** 765,766 **** --- 765,768 ---- { /* Add new patch number below this line */ + /**/ + 2356, /**/ -- Don't be humble ... you're not that great. -- Golda Meir /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///