]> granicus.if.org Git - vim/commitdiff
updated for version 7.4.079 v7.4.079
authorBram Moolenaar <Bram@vim.org>
Fri, 8 Nov 2013 03:30:20 +0000 (04:30 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 8 Nov 2013 03:30:20 +0000 (04:30 +0100)
Problem:    A script cannot detect whether 'hlsearch' highlighting is actually
            displayed.
Solution:   Add the "v:hlsearch" variable. (ZyX)

16 files changed:
src/eval.c
src/ex_docmd.c
src/option.c
src/screen.c
src/search.c
src/tag.c
src/testdir/Make_amiga.mak
src/testdir/Make_dos.mak
src/testdir/Make_ming.mak
src/testdir/Make_os2.mak
src/testdir/Make_vms.mms
src/testdir/Makefile
src/testdir/test101.in [new file with mode: 0644]
src/testdir/test101.ok [new file with mode: 0644]
src/version.c
src/vim.h

index 14ba4d8b2d80d17bfb4c697a77bc0abdf18b5da4..9fbef244cd60b0b27d2a77fe5c0238d55685cae8 100644 (file)
@@ -356,6 +356,7 @@ static struct vimvar
     {VV_NAME("mouse_col",       VAR_NUMBER), 0},
     {VV_NAME("operator",        VAR_STRING), VV_RO},
     {VV_NAME("searchforward",   VAR_NUMBER), 0},
+    {VV_NAME("hlsearch",        VAR_NUMBER), 0},
     {VV_NAME("oldfiles",        VAR_LIST), 0},
     {VV_NAME("windowid",        VAR_NUMBER), VV_RO},
 };
@@ -871,6 +872,7 @@ eval_init()
            hash_add(&compat_hashtab, p->vv_di.di_key);
     }
     set_vim_var_nr(VV_SEARCHFORWARD, 1L);
+    set_vim_var_nr(VV_HLSEARCH, 1L);
     set_reg_var(0);  /* default for v:register is not 0 but '"' */
 
 #ifdef EBCDIC
@@ -20613,6 +20615,13 @@ set_var(name, tv, copy)
                v->di_tv.vval.v_number = get_tv_number(tv);
                if (STRCMP(varname, "searchforward") == 0)
                    set_search_direction(v->di_tv.vval.v_number ? '/' : '?');
+#ifdef FEAT_SEARCH_EXTRA
+               else if (STRCMP(varname, "hlsearch") == 0)
+               {
+                   no_hlsearch = !v->di_tv.vval.v_number;
+                   redraw_all_later(SOME_VALID);
+               }
+#endif
            }
            return;
        }
index 24f80fbfa228ecdaa11cf11740147e8ee2d5b99b..5d207ea802f841b78750781b77ae5e4329ee378f 100644 (file)
@@ -11389,7 +11389,7 @@ ex_set(eap)
 ex_nohlsearch(eap)
     exarg_T    *eap UNUSED;
 {
-    no_hlsearch = TRUE;
+    SET_NO_HLSEARCH(TRUE);
     redraw_all_later(SOME_VALID);
 }
 
index 2b94d8525beeb1004b69198df08350d8909e8ed6..589e134445e054a9d4c4d2bef0536f74d2b3d94d 100644 (file)
@@ -7811,7 +7811,7 @@ set_bool_option(opt_idx, varp, value, opt_flags)
     /* when 'hlsearch' is set or reset: reset no_hlsearch */
     else if ((int *)varp == &p_hls)
     {
-       no_hlsearch = FALSE;
+       SET_NO_HLSEARCH(FALSE);
     }
 #endif
 
index a72ecaf20cbc5237403f4ce6e9885380c4ef617b..f738e2bb6ab8e7065d81646aa3f4ec97fe25c5dc 100644 (file)
@@ -7447,7 +7447,7 @@ next_search_hl(win, shl, lnum, mincol)
            {
                /* don't free regprog in the match list, it's a copy */
                vim_regfree(shl->rm.regprog);
-               no_hlsearch = TRUE;
+               SET_NO_HLSEARCH(TRUE);
            }
            shl->rm.regprog = NULL;
            shl->lnum = 0;
index d517c60529c9de9f2620c7dbf40325fedf15a454..2fb7624c49a7464cf1a50c97bee7071d75e07181 100644 (file)
@@ -289,7 +289,7 @@ save_re_pat(idx, pat, magic)
        /* If 'hlsearch' set and search pat changed: need redraw. */
        if (p_hls)
            redraw_all_later(SOME_VALID);
-       no_hlsearch = FALSE;
+       SET_NO_HLSEARCH(FALSE);
 #endif
     }
 }
@@ -333,7 +333,7 @@ restore_search_patterns()
        spats[1] = saved_spats[1];
        last_idx = saved_last_idx;
 # ifdef FEAT_SEARCH_EXTRA
-       no_hlsearch = saved_no_hlsearch;
+       SET_NO_HLSEARCH(saved_no_hlsearch);
 # endif
     }
 }
@@ -1148,7 +1148,7 @@ do_search(oap, dirc, pat, count, options, tm)
     if (no_hlsearch && !(options & SEARCH_KEEP))
     {
        redraw_all_later(SOME_VALID);
-       no_hlsearch = FALSE;
+       SET_NO_HLSEARCH(FALSE);
     }
 #endif
 
@@ -5561,7 +5561,9 @@ read_viminfo_search_pattern(virp, force)
                spats[idx].off.off = off;
 #ifdef FEAT_SEARCH_EXTRA
                if (setlast)
-                   no_hlsearch = !hlsearch_on;
+               {
+                   SET_NO_HLSEARCH(!hlsearch_on);
+               }
 #endif
            }
        }
index 55ace15bff6a486c20a7da26e4a07eb3e54e5298..e7ea52a2930eb9c19d6a25143e257209f54c322a 100644 (file)
--- a/src/tag.c
+++ b/src/tag.c
@@ -3330,7 +3330,9 @@ jumpto_tag(lbuf, forceit, keep_help)
 #ifdef FEAT_SEARCH_EXTRA
        /* restore no_hlsearch when keeping the old search pattern */
        if (search_options)
-           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 81633e7ca3f0809b07a6959461934c318686b19c..8842131b92865d6434029421a8fac0938719c9ac 100644 (file)
@@ -34,7 +34,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
                test81.out test82.out test83.out test84.out test88.out \
                test89.out test90.out test91.out test92.out test93.out \
                test94.out test95.out test96.out test97.out test98.out \
-               test99.out test100.out
+               test99.out test100.out test101.out
 
 .SUFFIXES: .in .out
 
@@ -151,3 +151,4 @@ test97.out: test97.in
 test98.out: test98.in
 test99.out: test99.in
 test100.out: test100.in
+test101.out: test101.in
index f89d99be73c5b0ccf5c25e999dd2e868e01a47ba..38208e748c4301847403fa7db9ac3057fdbc723f 100644 (file)
@@ -33,7 +33,7 @@ SCRIPTS =     test3.out test4.out test5.out test6.out test7.out \
                test84.out test85.out test86.out test87.out test88.out \
                test89.out test90.out test91.out test92.out test93.out \
                test94.out test95.out test96.out test98.out test99.out \
-               test100.out
+               test100.out test101.out
 
 SCRIPTS32 =    test50.out test70.out
 
index eb0c469df2bbc6c53b9de9ea8da138febf46123e..9ec1f06e64df08e3535dc33adb0126680fa1d3be 100644 (file)
@@ -53,7 +53,7 @@ SCRIPTS =     test3.out test4.out test5.out test6.out test7.out \
                test84.out test85.out test86.out test87.out test88.out \
                test89.out test90.out test91.out test92.out test93.out \
                test94.out test95.out test96.out test98.out test99.out \
-               test100out
+               test100out test101.out
 
 SCRIPTS32 =    test50.out test70.out
 
index acb7bd76b5a5b7753856303a5554dd34dabc659c..823a706fab71bc0f6f6d28d5c0c38a43eef4a45c 100644 (file)
@@ -35,7 +35,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
                test81.out test82.out test83.out test84.out test88.out \
                test89.out test90.out test91.out test92.out test93.out \
                test94.out test95.out test96.out test98.out test99.out \
-               test100.out
+               test100.out test101.out
 
 .SUFFIXES: .in .out
 
index 816123d6f66948c2601f07bd2c47f215d29c3bf0..2626b5bb9b461b745fb4ccf0eb1190c7e9c2a791 100644 (file)
@@ -4,7 +4,7 @@
 # Authors:     Zoltan Arpadffy, <arpadffy@polarhome.com>
 #              Sandor Kopanyi,  <sandor.kopanyi@mailbox.hu>
 #
-# Last change:  2013 Nov 07
+# Last change:  2013 Nov 08
 #
 # This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
 # Edit the lines in the Configuration section below to select.
@@ -79,7 +79,7 @@ SCRIPT = test1.out  test2.out  test3.out  test4.out  test5.out  \
         test82.out test83.out test84.out test88.out test89.out \
         test90.out test91.out test92.out test93.out test94.out \
         test95.out test96.out test97.out test98.out test99.out \
-        test100.out
+        test100.out test101.out
 
 # Known problems:
 # Test 30: a problem around mac format - unknown reason
index 3620cee178e5ca20f28e759b5f96bd5f40be353b..aa3777c92ce99477f046b45bc5c6e8285b0bb058 100644 (file)
@@ -30,7 +30,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
                test84.out test85.out test86.out test87.out test88.out \
                test89.out test90.out test91.out test92.out test93.out \
                test94.out test95.out test96.out test97.out test98.out \
-               test99.out test100.out
+               test99.out test100.out test101.out
 
 SCRIPTS_GUI = test16.out
 
diff --git a/src/testdir/test101.in b/src/testdir/test101.in
new file mode 100644 (file)
index 0000000..04c934f
--- /dev/null
@@ -0,0 +1,45 @@
+Test for v:hlsearch     vim: set ft=vim :
+
+STARTTEST
+:" Last abc: Q
+:so small.vim
+:new
+:call setline(1, repeat(['aaa'], 10))
+:set hlsearch nolazyredraw
+:let r=[]
+:command -nargs=0 -bar AddR :call add(r, [screenattr(1, 1), v:hlsearch])
+/aaa
+:AddR
+:nohlsearch
+:AddR
+:let v:hlsearch=1
+:AddR
+:let v:hlsearch=0
+:AddR
+:set hlsearch
+:AddR
+:let v:hlsearch=0
+:AddR
+n:AddR
+:let v:hlsearch=0
+:AddR
+/
+:AddR
+:let r1=r[0][0]
+:" I guess it is not guaranteed that screenattr outputs always the same character
+:call map(r, 'v:val[1].":".(v:val[0]==r1?"highlighted":"not highlighted")')
+:try
+:   let v:hlsearch=[]
+:catch
+:   call add(r, matchstr(v:exception,'^Vim(let):E\d\+:'))
+:endtry
+:bwipeout!
+:$put=r
+:call garbagecollect(1)
+:"
+:/^start:/,$wq! test.out
+:" vim: et ts=4 isk-=\:
+:call getchar()
+ENDTEST
+
+start:
diff --git a/src/testdir/test101.ok b/src/testdir/test101.ok
new file mode 100644 (file)
index 0000000..3ed7436
--- /dev/null
@@ -0,0 +1,11 @@
+start:
+1:highlighted
+0:not highlighted
+1:highlighted
+0:not highlighted
+1:highlighted
+0:not highlighted
+1:highlighted
+0:not highlighted
+1:highlighted
+Vim(let):E706:
index aef087992364250af7c334cabba0853e49e637d6..106445a021c9f1efa44058df2d61ad4b1be5ba7c 100644 (file)
@@ -738,6 +738,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    79,
 /**/
     78,
 /**/
index 3d61f3a35fcf9834369783523615a9ad691bcee5..4d8d5e82fcbfd6e5d46384733fdc12c9cf3bdbb4 100644 (file)
--- a/src/vim.h
+++ b/src/vim.h
@@ -1864,9 +1864,10 @@ typedef int proftime_T;      /* dummy for function prototypes */
 #define VV_MOUSE_COL   51
 #define VV_OP          52
 #define VV_SEARCHFORWARD 53
-#define VV_OLDFILES    54
-#define VV_WINDOWID    55
-#define VV_LEN         56      /* number of v: vars */
+#define VV_HLSEARCH    54
+#define VV_OLDFILES    55
+#define VV_WINDOWID    56
+#define VV_LEN         57      /* number of v: vars */
 
 #ifdef FEAT_CLIPBOARD
 
@@ -2246,4 +2247,10 @@ typedef int VimClipboard;        /* This is required for the prototypes. */
 /* 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)
+#else
+# define SET_NO_HLSEARCH(flag) no_hlsearch = (flag)
+#endif
+
 #endif /* VIM__H */