Mercurial > vim
comparison src/ex_getln.c @ 14546:35e7ead872db v8.1.0286
patch 8.1.0286: 'incsearch' does not apply to :smagic and :snomagic
commit https://github.com/vim/vim/commit/167ae42685dcd430800c51ac7339f7f0938a3e70
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Aug 14 21:32:21 2018 +0200
patch 8.1.0286: 'incsearch' does not apply to :smagic and :snomagic
Problem: 'incsearch' does not apply to :smagic and :snomagic.
Solution: Add support. (Hirohito Higashi)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 14 Aug 2018 21:45:04 +0200 |
parents | 2b2d7ae42fb8 |
children | 806e1a2648c6 |
comparison
equal
deleted
inserted
replaced
14545:a259914eb676 | 14546:35e7ead872db |
---|---|
229 viewstate_T old_viewstate; | 229 viewstate_T old_viewstate; |
230 pos_T match_start; | 230 pos_T match_start; |
231 pos_T match_end; | 231 pos_T match_end; |
232 int did_incsearch; | 232 int did_incsearch; |
233 int incsearch_postponed; | 233 int incsearch_postponed; |
234 int magic_save; | |
234 } incsearch_state_T; | 235 } incsearch_state_T; |
235 | 236 |
236 static void | 237 static void |
237 init_incsearch_state(incsearch_state_T *is_state) | 238 init_incsearch_state(incsearch_state_T *is_state) |
238 { | 239 { |
239 is_state->match_start = curwin->w_cursor; | 240 is_state->match_start = curwin->w_cursor; |
240 is_state->did_incsearch = FALSE; | 241 is_state->did_incsearch = FALSE; |
241 is_state->incsearch_postponed = FALSE; | 242 is_state->incsearch_postponed = FALSE; |
243 is_state->magic_save = p_magic; | |
242 CLEAR_POS(&is_state->match_end); | 244 CLEAR_POS(&is_state->match_end); |
243 is_state->save_cursor = curwin->w_cursor; // may be restored later | 245 is_state->save_cursor = curwin->w_cursor; // may be restored later |
244 is_state->search_start = curwin->w_cursor; | 246 is_state->search_start = curwin->w_cursor; |
245 save_viewstate(&is_state->init_viewstate); | 247 save_viewstate(&is_state->init_viewstate); |
246 save_viewstate(&is_state->old_viewstate); | 248 save_viewstate(&is_state->old_viewstate); |
306 // Skip over "substitute" to find the pattern separator. | 308 // Skip over "substitute" to find the pattern separator. |
307 for (p = cmd; ASCII_ISALPHA(*p); ++p) | 309 for (p = cmd; ASCII_ISALPHA(*p); ++p) |
308 ; | 310 ; |
309 if (*skipwhite(p) != NUL | 311 if (*skipwhite(p) != NUL |
310 && (STRNCMP(cmd, "substitute", p - cmd) == 0 | 312 && (STRNCMP(cmd, "substitute", p - cmd) == 0 |
313 || STRNCMP(cmd, "smagic", p - cmd) == 0 | |
314 || STRNCMP(cmd, "snomagic", MAX(p - cmd, 3)) == 0 | |
311 || STRNCMP(cmd, "global", p - cmd) == 0 | 315 || STRNCMP(cmd, "global", p - cmd) == 0 |
312 || STRNCMP(cmd, "vglobal", p - cmd) == 0)) | 316 || STRNCMP(cmd, "vglobal", p - cmd) == 0)) |
313 { | 317 { |
318 if (*cmd == 's' && cmd[1] == 'm') | |
319 p_magic = TRUE; | |
320 else if (*cmd == 's' && cmd[1] == 'n') | |
321 p_magic = FALSE; | |
322 | |
314 // Check for "global!/". | 323 // Check for "global!/". |
315 if (*cmd == 'g' && *p == '!') | 324 if (*cmd == 'g' && *p == '!') |
316 { | 325 { |
317 p++; | 326 p++; |
318 if (*skipwhite(p) == NUL) | 327 if (*skipwhite(p) == NUL) |
390 validate_cursor(); /* needed for TAB */ | 399 validate_cursor(); /* needed for TAB */ |
391 if (call_update_screen) | 400 if (call_update_screen) |
392 update_screen(SOME_VALID); | 401 update_screen(SOME_VALID); |
393 else | 402 else |
394 redraw_all_later(SOME_VALID); | 403 redraw_all_later(SOME_VALID); |
404 p_magic = is_state->magic_save; | |
395 } | 405 } |
396 } | 406 } |
397 | 407 |
398 /* | 408 /* |
399 * Do 'incsearch' highlighting if desired. | 409 * Do 'incsearch' highlighting if desired. |