Mercurial > vim
comparison src/ex_getln.c @ 15083:70aa5caa9f0d v8.1.0552
patch 8.1.0552: saved last search pattern may not be restored
commit https://github.com/vim/vim/commit/01a060da74b756b161e595b39a7877cb7612120a
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Nov 30 21:57:55 2018 +0100
patch 8.1.0552: saved last search pattern may not be restored
Problem: Saved last search pattern may not be restored.
Solution: Call restore_last_search_pattern(). Add a check for balancing
saving and restoring the last search pattern.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 30 Nov 2018 22:00:06 +0100 |
parents | 7b2dcca9e0c1 |
children | 9df130fd5e0d |
comparison
equal
deleted
inserted
replaced
15082:f97a2baf493a | 15083:70aa5caa9f0d |
---|---|
460 #endif | 460 #endif |
461 int next_char; | 461 int next_char; |
462 int use_last_pat; | 462 int use_last_pat; |
463 | 463 |
464 // Parsing range may already set the last search pattern. | 464 // Parsing range may already set the last search pattern. |
465 // NOTE: must call restore_last_search_pattern() before returning! | |
465 save_last_search_pattern(); | 466 save_last_search_pattern(); |
466 | 467 |
467 if (!do_incsearch_highlighting(firstc, is_state, &skiplen, &patlen)) | 468 if (!do_incsearch_highlighting(firstc, is_state, &skiplen, &patlen)) |
468 { | 469 { |
469 restore_last_search_pattern(); | 470 restore_last_search_pattern(); |
631 int search_flags = SEARCH_NOOF; | 632 int search_flags = SEARCH_NOOF; |
632 int i; | 633 int i; |
633 int save; | 634 int save; |
634 | 635 |
635 // Parsing range may already set the last search pattern. | 636 // Parsing range may already set the last search pattern. |
637 // NOTE: must call restore_last_search_pattern() before returning! | |
636 save_last_search_pattern(); | 638 save_last_search_pattern(); |
637 | 639 |
638 if (!do_incsearch_highlighting(firstc, is_state, &skiplen, &patlen)) | 640 if (!do_incsearch_highlighting(firstc, is_state, &skiplen, &patlen)) |
639 { | 641 { |
640 restore_last_search_pattern(); | 642 restore_last_search_pattern(); |
733 may_add_char_to_search(int firstc, int *c, incsearch_state_T *is_state) | 735 may_add_char_to_search(int firstc, int *c, incsearch_state_T *is_state) |
734 { | 736 { |
735 int skiplen, patlen; | 737 int skiplen, patlen; |
736 | 738 |
737 // Parsing range may already set the last search pattern. | 739 // Parsing range may already set the last search pattern. |
740 // NOTE: must call restore_last_search_pattern() before returning! | |
738 save_last_search_pattern(); | 741 save_last_search_pattern(); |
739 | 742 |
740 if (!do_incsearch_highlighting(firstc, is_state, &skiplen, &patlen)) | 743 if (!do_incsearch_highlighting(firstc, is_state, &skiplen, &patlen)) |
741 { | 744 { |
742 restore_last_search_pattern(); | 745 restore_last_search_pattern(); |
743 return FAIL; | 746 return FAIL; |
744 } | 747 } |
748 restore_last_search_pattern(); | |
745 | 749 |
746 // Add a character from under the cursor for 'incsearch'. | 750 // Add a character from under the cursor for 'incsearch'. |
747 if (is_state->did_incsearch) | 751 if (is_state->did_incsearch) |
748 { | 752 { |
749 curwin->w_cursor = is_state->match_end; | 753 curwin->w_cursor = is_state->match_end; |