Mercurial > vim
diff src/search.c @ 13380:69517d67421f v8.0.1564
patch 8.0.1564: too many #ifdefs
commit https://github.com/vim/vim/commit/f2bd8ef2b4507d02c6043affff8f7e85e3414d5f
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Mar 4 18:08:14 2018 +0100
patch 8.0.1564: too many #ifdefs
Problem: Too many #ifdefs.
Solution: Graduate the +autocmd feature. Takes away 450 #ifdefs and
increases code size of tiny Vim by only 40 Kbyte.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 04 Mar 2018 18:15:08 +0100 |
parents | ac42c4b11dbc |
children | 9de2b25932eb |
line wrap: on
line diff
--- a/src/search.c +++ b/src/search.c @@ -97,10 +97,8 @@ static char_u lastc_bytes[MB_MAXBYTES + static int lastc_bytelen = 1; /* >1 for multi-byte char */ #endif -#if defined(FEAT_AUTOCMD) || defined(FEAT_EVAL) || defined(PROTO) /* copy of spats[], for keeping the search patterns while executing autocmds */ static struct spat saved_spats[2]; -#endif # ifdef FEAT_SEARCH_EXTRA /* copy of spats[RE_SEARCH], for keeping the search patterns while incremental * searching */ @@ -300,7 +298,6 @@ save_re_pat(int idx, char_u *pat, int ma } } -#if defined(FEAT_AUTOCMD) || defined(FEAT_EVAL) || defined(PROTO) /* * Save the search patterns, so they can be restored later. * Used before/after executing autocommands and user functions. @@ -318,10 +315,10 @@ save_search_patterns(void) saved_spats[1] = spats[1]; if (spats[1].pat != NULL) saved_spats[1].pat = vim_strsave(spats[1].pat); +#ifdef FEAT_SEARCH_EXTRA saved_last_idx = last_idx; -# ifdef FEAT_SEARCH_EXTRA saved_no_hlsearch = no_hlsearch; -# endif +#endif } } @@ -332,18 +329,17 @@ restore_search_patterns(void) { vim_free(spats[0].pat); spats[0] = saved_spats[0]; -# if defined(FEAT_EVAL) +#if defined(FEAT_EVAL) set_vv_searchforward(); -# endif +#endif vim_free(spats[1].pat); spats[1] = saved_spats[1]; +#ifdef FEAT_SEARCH_EXTRA last_idx = saved_last_idx; -# ifdef FEAT_SEARCH_EXTRA SET_NO_HLSEARCH(saved_no_hlsearch); -# endif +#endif } } -#endif #if defined(EXITFREE) || defined(PROTO) void