summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0286
blob: d6507bdf951a0ba8fd8bfabb66f5dfd73f9d82c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0286
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
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\<c-l>/xxx\<cr>", 'tx')
    call assert_equal('  2 xxxe', getline('.'))
+   undo
+   call feedkeys(":%smagic/the.e/xxx\<cr>", 'tx')
+   call assert_equal('  2 xxx', getline('.'))
+   undo
+   call assert_fails(":%snomagic/the.e/xxx\<cr>", 'E486')
+   "
+   call feedkeys(":%snomagic/the\\.e/xxx\<cr>", '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    ///