]> granicus.if.org Git - vim/commitdiff
patch 8.0.1768: SET_NO_HLSEARCH() used in a wrong way v8.0.1768
authorBram Moolenaar <Bram@vim.org>
Fri, 27 Apr 2018 20:53:07 +0000 (22:53 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 27 Apr 2018 20:53:07 +0000 (22:53 +0200)
Problem:    SET_NO_HLSEARCH() used in a wrong way.
Solution:   Make it a function. (suggested by Dominique Pelle,
            closes #2850)

src/ex_docmd.c
src/ex_getln.c
src/option.c
src/proto/ex_docmd.pro
src/screen.c
src/search.c
src/tag.c
src/version.c
src/vim.h

index 046ef3cf5d8a6ce682b15efd9cca472c7af3d494..29270ad488e0ee0aaaa23c2a211641ff6f170f8f 100644 (file)
@@ -12193,14 +12193,23 @@ ex_set(exarg_T *eap)
        (void)do_set(eap->arg, flags);
 }
 
-#ifdef FEAT_SEARCH_EXTRA
+#if defined(FEAT_SEARCH_EXTRA) || defined(PROTO)
+    void
+set_no_hlsearch(int flag)
+{
+    no_hlsearch = flag;
+# ifdef FEAT_EVAL
+    set_vim_var_nr(VV_HLSEARCH, !no_hlsearch && p_hls);
+# endif
+}
+
 /*
  * ":nohlsearch"
  */
     static void
 ex_nohlsearch(exarg_T *eap UNUSED)
 {
-    SET_NO_HLSEARCH(TRUE);
+    set_no_hlsearch(TRUE);
     redraw_all_later(SOME_VALID);
 }
 
index 5a1bdc0ea770a169a2299d4c3216756c3383fb50..ef8b4bdac683e0cb4b72ab238764be33b297e612 100644 (file)
@@ -1976,7 +1976,7 @@ cmdline_changed:
            if (ccline.cmdlen == 0)
            {
                i = 0;
-               SET_NO_HLSEARCH(TRUE); /* turn off previous highlight */
+               set_no_hlsearch(TRUE); /* turn off previous highlight */
                redraw_all_later(SOME_VALID);
            }
            else
@@ -2045,7 +2045,7 @@ cmdline_changed:
            /* Disable 'hlsearch' highlighting if the pattern matches
             * everything. Avoids a flash when typing "foo\|". */
            if (empty_pattern(ccline.cmdbuff))
-               SET_NO_HLSEARCH(TRUE);
+               set_no_hlsearch(TRUE);
 
            validate_cursor();
            /* May redraw the status line to show the cursor position. */
index 31aec7e78113166513b2cf82c773c2cbf30ce111..807b1e043712a4eda410c85da56461fef7a3cd55 100644 (file)
@@ -8359,7 +8359,7 @@ set_bool_option(
     /* when 'hlsearch' is set or reset: reset no_hlsearch */
     else if ((int *)varp == &p_hls)
     {
-       SET_NO_HLSEARCH(FALSE);
+       set_no_hlsearch(FALSE);
     }
 #endif
 
index 0eace6222f7ecfb30ccd6efc54efbc4bdda5889f..acd6b08ed820a984568a9e16c159a90d3e45f2f1 100644 (file)
@@ -66,6 +66,7 @@ void dialog_msg(char_u *buff, char *format, char_u *fname);
 char_u *get_behave_arg(expand_T *xp, int idx);
 char_u *get_messages_arg(expand_T *xp, int idx);
 char_u *get_mapclear_arg(expand_T *xp, int idx);
+void set_no_hlsearch(int flag);
 int get_pressedreturn(void);
 void set_pressedreturn(int val);
 /* vim: set ft=c : */
index d1f17b51bae49be616f6cc915c1b892943e4bc34..06dc30439f50aaaedb06bf20b0acf6c634db953d 100644 (file)
@@ -7945,7 +7945,7 @@ next_search_hl(
                {
                    /* don't free regprog in the match list, it's a copy */
                    vim_regfree(shl->rm.regprog);
-                   SET_NO_HLSEARCH(TRUE);
+                   set_no_hlsearch(TRUE);
                }
                shl->rm.regprog = NULL;
                shl->lnum = 0;
index a34636227a8436143fabcd474ff44085b9cd3a84..726013e6207dee4dde0391834b1a4959197ff8e6 100644 (file)
@@ -293,7 +293,7 @@ save_re_pat(int idx, char_u *pat, int magic)
        /* If 'hlsearch' set and search pat changed: need redraw. */
        if (p_hls)
            redraw_all_later(SOME_VALID);
-       SET_NO_HLSEARCH(FALSE);
+       set_no_hlsearch(FALSE);
 #endif
     }
 }
@@ -336,7 +336,7 @@ restore_search_patterns(void)
        spats[1] = saved_spats[1];
 #ifdef FEAT_SEARCH_EXTRA
        last_idx = saved_last_idx;
-       SET_NO_HLSEARCH(saved_no_hlsearch);
+       set_no_hlsearch(saved_no_hlsearch);
 #endif
     }
 }
@@ -387,7 +387,7 @@ restore_last_search_pattern(void)
     set_vv_searchforward();
 # endif
     last_idx = saved_last_idx;
-    SET_NO_HLSEARCH(saved_no_hlsearch);
+    set_no_hlsearch(saved_no_hlsearch);
 }
 
     char_u *
@@ -1282,7 +1282,7 @@ do_search(
     if (no_hlsearch && !(options & SEARCH_KEEP))
     {
        redraw_all_later(SOME_VALID);
-       SET_NO_HLSEARCH(FALSE);
+       set_no_hlsearch(FALSE);
     }
 #endif
 
@@ -5757,9 +5757,7 @@ read_viminfo_search_pattern(vir_T *virp, int force)
                spats[idx].off.off = off;
 #ifdef FEAT_SEARCH_EXTRA
                if (setlast)
-               {
-                   SET_NO_HLSEARCH(!hlsearch_on);
-               }
+                   set_no_hlsearch(!hlsearch_on);
 #endif
            }
        }
index ca1f2f365564e73c8c9b705b0413c89629d1624c..92ed2a7c4ce63e5c6df2ee69f3785747589a63ed 100644 (file)
--- a/src/tag.c
+++ b/src/tag.c
@@ -3409,9 +3409,7 @@ jumpto_tag(
 #ifdef FEAT_SEARCH_EXTRA
        /* restore no_hlsearch when keeping the old search pattern */
        if (search_options)
-       {
-           SET_NO_HLSEARCH(save_no_hlsearch);
-       }
+           set_no_hlsearch(save_no_hlsearch);
 #endif
 
        /* Return OK if jumped to another file (at least we found the file!). */
index 428ae28f3f0a391ff6cb0484588a2343d23cb55b..773e4b47795cef960037c9f7deefca598c9c1ed5 100644 (file)
@@ -761,6 +761,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1768,
 /**/
     1767,
 /**/
index df396ec0516249df104b0a9a6c5b3a9a125b3f26..985a4926d7d88a4f687aab346852c9c6054f577e 100644 (file)
--- a/src/vim.h
+++ b/src/vim.h
@@ -2458,12 +2458,6 @@ typedef enum {
 /* Character used as separated in autoload function/variable names. */
 #define AUTOLOAD_CHAR '#'
 
-#ifdef FEAT_EVAL
-# define SET_NO_HLSEARCH(flag) no_hlsearch = (flag); set_vim_var_nr(VV_HLSEARCH, !no_hlsearch && p_hls)
-#else
-# define SET_NO_HLSEARCH(flag) no_hlsearch = (flag)
-#endif
-
 #ifdef FEAT_JOB_CHANNEL
 # define MAX_OPEN_CHANNELS 10
 #else