To: vim_dev@googlegroups.com Subject: Patch 8.1.0286 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0286 Problem: 'incsearch' does not apply to :smagic and :snomagic. Solution: Add support. (Hirohito Higashi) Files: src/ex_getln.c, src/testdir/test_search.vim *** ../vim-8.1.0285/src/ex_getln.c 2018-08-14 20:18:22.680907439 +0200 --- src/ex_getln.c 2018-08-14 21:10:45.311635658 +0200 *************** *** 231,236 **** --- 231,237 ---- pos_T match_end; int did_incsearch; int incsearch_postponed; + int magic_save; } incsearch_state_T; static void *************** *** 239,244 **** --- 240,246 ---- is_state->match_start = curwin->w_cursor; is_state->did_incsearch = FALSE; is_state->incsearch_postponed = FALSE; + is_state->magic_save = p_magic; CLEAR_POS(&is_state->match_end); is_state->save_cursor = curwin->w_cursor; // may be restored later is_state->search_start = curwin->w_cursor; *************** *** 308,316 **** --- 310,325 ---- ; if (*skipwhite(p) != NUL && (STRNCMP(cmd, "substitute", p - cmd) == 0 + || STRNCMP(cmd, "smagic", p - cmd) == 0 + || STRNCMP(cmd, "snomagic", MAX(p - cmd, 3)) == 0 || STRNCMP(cmd, "global", p - cmd) == 0 || STRNCMP(cmd, "vglobal", p - cmd) == 0)) { + if (*cmd == 's' && cmd[1] == 'm') + p_magic = TRUE; + else if (*cmd == 's' && cmd[1] == 'n') + p_magic = FALSE; + // Check for "global!/". if (*cmd == 'g' && *p == '!') { *************** *** 392,397 **** --- 401,407 ---- update_screen(SOME_VALID); else redraw_all_later(SOME_VALID); + p_magic = is_state->magic_save; } } *** ../vim-8.1.0285/src/testdir/test_search.vim 2018-08-14 18:16:30.683488007 +0200 --- src/testdir/test_search.vim 2018-08-14 21:10:45.315635631 +0200 *************** *** 384,389 **** --- 384,397 ---- undo call feedkeys(":%substitute/the\/xxx\", 'tx') call assert_equal(' 2 xxxe', getline('.')) + undo + call feedkeys(":%smagic/the.e/xxx\", 'tx') + call assert_equal(' 2 xxx', getline('.')) + undo + call assert_fails(":%snomagic/the.e/xxx\", 'E486') + " + call feedkeys(":%snomagic/the\\.e/xxx\", 'tx') + call assert_equal(' 2 xxx', getline('.')) call Incsearch_cleanup() endfunc *** ../vim-8.1.0285/src/version.c 2018-08-14 20:18:22.680907439 +0200 --- src/version.c 2018-08-14 21:11:49.531195730 +0200 *************** *** 796,797 **** --- 796,799 ---- { /* Add new patch number below this line */ + /**/ + 286, /**/ -- ARTHUR: If you do not open these doors, we will take this castle by force ... [A bucket of slops land on ARTHUR. He tries to retain his dignity.] "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// 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 ///