Blame SOURCES/7.4.079

22c937
To: vim_dev@googlegroups.com
22c937
Subject: Patch 7.4.079
22c937
Fcc: outbox
22c937
From: Bram Moolenaar <Bram@moolenaar.net>
22c937
Mime-Version: 1.0
22c937
Content-Type: text/plain; charset=UTF-8
22c937
Content-Transfer-Encoding: 8bit
22c937
------------
22c937
22c937
Patch 7.4.079
22c937
Problem:    A script cannot detect whether 'hlsearch' highlighting is actually
22c937
            displayed.
22c937
Solution:   Add the "v:hlsearch" variable. (ZyX)
22c937
Files:      src/runtime/doc/eval.txt, src/eval.c, src/ex_docmd.c,
22c937
            src/option.c, src/screen.c, src/search.c, src/tag.c, src/vim.h,
22c937
            src/testdir/test101.in, src/testdir/test101.ok,
22c937
            src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak,
22c937
            src/testdir/Make_ming.mak, src/testdir/Make_os2.mak,
22c937
            src/testdir/Make_vms.mms, src/testdir/Makefile
22c937
22c937
22c937
diff: ../vim-7.4.078/src/runtime/doc/eval.txt: No such file or directory
22c937
diff: src/runtime/doc/eval.txt: No such file or directory
22c937
*** ../vim-7.4.078/src/eval.c	2013-11-05 07:12:59.000000000 +0100
22c937
--- src/eval.c	2013-11-08 04:11:46.000000000 +0100
22c937
***************
22c937
*** 356,361 ****
22c937
--- 356,362 ----
22c937
      {VV_NAME("mouse_col",	 VAR_NUMBER), 0},
22c937
      {VV_NAME("operator",	 VAR_STRING), VV_RO},
22c937
      {VV_NAME("searchforward",	 VAR_NUMBER), 0},
22c937
+     {VV_NAME("hlsearch",	 VAR_NUMBER), 0},
22c937
      {VV_NAME("oldfiles",	 VAR_LIST), 0},
22c937
      {VV_NAME("windowid",	 VAR_NUMBER), VV_RO},
22c937
  };
22c937
***************
22c937
*** 871,876 ****
22c937
--- 872,878 ----
22c937
  	    hash_add(&compat_hashtab, p->vv_di.di_key);
22c937
      }
22c937
      set_vim_var_nr(VV_SEARCHFORWARD, 1L);
22c937
+     set_vim_var_nr(VV_HLSEARCH, 1L);
22c937
      set_reg_var(0);  /* default for v:register is not 0 but '"' */
22c937
  
22c937
  #ifdef EBCDIC
22c937
***************
22c937
*** 20613,20618 ****
22c937
--- 20615,20627 ----
22c937
  		v->di_tv.vval.v_number = get_tv_number(tv);
22c937
  		if (STRCMP(varname, "searchforward") == 0)
22c937
  		    set_search_direction(v->di_tv.vval.v_number ? '/' : '?');
22c937
+ #ifdef FEAT_SEARCH_EXTRA
22c937
+ 		else if (STRCMP(varname, "hlsearch") == 0)
22c937
+ 		{
22c937
+ 		    no_hlsearch = !v->di_tv.vval.v_number;
22c937
+ 		    redraw_all_later(SOME_VALID);
22c937
+ 		}
22c937
+ #endif
22c937
  	    }
22c937
  	    return;
22c937
  	}
22c937
*** ../vim-7.4.078/src/ex_docmd.c	2013-07-24 15:09:37.000000000 +0200
22c937
--- src/ex_docmd.c	2013-11-08 04:17:01.000000000 +0100
22c937
***************
22c937
*** 11389,11395 ****
22c937
  ex_nohlsearch(eap)
22c937
      exarg_T	*eap UNUSED;
22c937
  {
22c937
!     no_hlsearch = TRUE;
22c937
      redraw_all_later(SOME_VALID);
22c937
  }
22c937
  
22c937
--- 11389,11395 ----
22c937
  ex_nohlsearch(eap)
22c937
      exarg_T	*eap UNUSED;
22c937
  {
22c937
!     SET_NO_HLSEARCH(TRUE);
22c937
      redraw_all_later(SOME_VALID);
22c937
  }
22c937
  
22c937
*** ../vim-7.4.078/src/option.c	2013-11-06 05:26:08.000000000 +0100
22c937
--- src/option.c	2013-11-08 04:17:32.000000000 +0100
22c937
***************
22c937
*** 7811,7817 ****
22c937
      /* when 'hlsearch' is set or reset: reset no_hlsearch */
22c937
      else if ((int *)varp == &p_hls)
22c937
      {
22c937
! 	no_hlsearch = FALSE;
22c937
      }
22c937
  #endif
22c937
  
22c937
--- 7811,7817 ----
22c937
      /* when 'hlsearch' is set or reset: reset no_hlsearch */
22c937
      else if ((int *)varp == &p_hls)
22c937
      {
22c937
! 	SET_NO_HLSEARCH(FALSE);
22c937
      }
22c937
  #endif
22c937
  
22c937
*** ../vim-7.4.078/src/screen.c	2013-07-13 12:23:00.000000000 +0200
22c937
--- src/screen.c	2013-11-08 04:17:48.000000000 +0100
22c937
***************
22c937
*** 7447,7453 ****
22c937
  	    {
22c937
  		/* don't free regprog in the match list, it's a copy */
22c937
  		vim_regfree(shl->rm.regprog);
22c937
! 		no_hlsearch = TRUE;
22c937
  	    }
22c937
  	    shl->rm.regprog = NULL;
22c937
  	    shl->lnum = 0;
22c937
--- 7447,7453 ----
22c937
  	    {
22c937
  		/* don't free regprog in the match list, it's a copy */
22c937
  		vim_regfree(shl->rm.regprog);
22c937
! 		SET_NO_HLSEARCH(TRUE);
22c937
  	    }
22c937
  	    shl->rm.regprog = NULL;
22c937
  	    shl->lnum = 0;
22c937
*** ../vim-7.4.078/src/search.c	2013-11-07 04:46:43.000000000 +0100
22c937
--- src/search.c	2013-11-08 04:18:57.000000000 +0100
22c937
***************
22c937
*** 289,295 ****
22c937
  	/* If 'hlsearch' set and search pat changed: need redraw. */
22c937
  	if (p_hls)
22c937
  	    redraw_all_later(SOME_VALID);
22c937
! 	no_hlsearch = FALSE;
22c937
  #endif
22c937
      }
22c937
  }
22c937
--- 289,295 ----
22c937
  	/* If 'hlsearch' set and search pat changed: need redraw. */
22c937
  	if (p_hls)
22c937
  	    redraw_all_later(SOME_VALID);
22c937
! 	SET_NO_HLSEARCH(FALSE);
22c937
  #endif
22c937
      }
22c937
  }
22c937
***************
22c937
*** 333,339 ****
22c937
  	spats[1] = saved_spats[1];
22c937
  	last_idx = saved_last_idx;
22c937
  # ifdef FEAT_SEARCH_EXTRA
22c937
! 	no_hlsearch = saved_no_hlsearch;
22c937
  # endif
22c937
      }
22c937
  }
22c937
--- 333,339 ----
22c937
  	spats[1] = saved_spats[1];
22c937
  	last_idx = saved_last_idx;
22c937
  # ifdef FEAT_SEARCH_EXTRA
22c937
! 	SET_NO_HLSEARCH(saved_no_hlsearch);
22c937
  # endif
22c937
      }
22c937
  }
22c937
***************
22c937
*** 1148,1154 ****
22c937
      if (no_hlsearch && !(options & SEARCH_KEEP))
22c937
      {
22c937
  	redraw_all_later(SOME_VALID);
22c937
! 	no_hlsearch = FALSE;
22c937
      }
22c937
  #endif
22c937
  
22c937
--- 1148,1154 ----
22c937
      if (no_hlsearch && !(options & SEARCH_KEEP))
22c937
      {
22c937
  	redraw_all_later(SOME_VALID);
22c937
! 	SET_NO_HLSEARCH(FALSE);
22c937
      }
22c937
  #endif
22c937
  
22c937
***************
22c937
*** 5561,5567 ****
22c937
  		spats[idx].off.off = off;
22c937
  #ifdef FEAT_SEARCH_EXTRA
22c937
  		if (setlast)
22c937
! 		    no_hlsearch = !hlsearch_on;
22c937
  #endif
22c937
  	    }
22c937
  	}
22c937
--- 5561,5569 ----
22c937
  		spats[idx].off.off = off;
22c937
  #ifdef FEAT_SEARCH_EXTRA
22c937
  		if (setlast)
22c937
! 		{
22c937
! 		    SET_NO_HLSEARCH(!hlsearch_on);
22c937
! 		}
22c937
  #endif
22c937
  	    }
22c937
  	}
22c937
*** ../vim-7.4.078/src/tag.c	2013-09-05 12:06:26.000000000 +0200
22c937
--- src/tag.c	2013-11-08 04:19:14.000000000 +0100
22c937
***************
22c937
*** 3330,3336 ****
22c937
  #ifdef FEAT_SEARCH_EXTRA
22c937
  	/* restore no_hlsearch when keeping the old search pattern */
22c937
  	if (search_options)
22c937
! 	    no_hlsearch = save_no_hlsearch;
22c937
  #endif
22c937
  
22c937
  	/* Return OK if jumped to another file (at least we found the file!). */
22c937
--- 3330,3338 ----
22c937
  #ifdef FEAT_SEARCH_EXTRA
22c937
  	/* restore no_hlsearch when keeping the old search pattern */
22c937
  	if (search_options)
22c937
! 	{
22c937
! 	    SET_NO_HLSEARCH(save_no_hlsearch);
22c937
! 	}
22c937
  #endif
22c937
  
22c937
  	/* Return OK if jumped to another file (at least we found the file!). */
22c937
*** ../vim-7.4.078/src/vim.h	2013-08-02 16:02:27.000000000 +0200
22c937
--- src/vim.h	2013-11-08 04:16:57.000000000 +0100
22c937
***************
22c937
*** 1864,1872 ****
22c937
  #define VV_MOUSE_COL	51
22c937
  #define VV_OP		52
22c937
  #define VV_SEARCHFORWARD 53
22c937
! #define VV_OLDFILES	54
22c937
! #define VV_WINDOWID	55
22c937
! #define VV_LEN		56	/* number of v: vars */
22c937
  
22c937
  #ifdef FEAT_CLIPBOARD
22c937
  
22c937
--- 1864,1873 ----
22c937
  #define VV_MOUSE_COL	51
22c937
  #define VV_OP		52
22c937
  #define VV_SEARCHFORWARD 53
22c937
! #define VV_HLSEARCH	54
22c937
! #define VV_OLDFILES	55
22c937
! #define VV_WINDOWID	56
22c937
! #define VV_LEN		57	/* number of v: vars */
22c937
  
22c937
  #ifdef FEAT_CLIPBOARD
22c937
  
22c937
***************
22c937
*** 2246,2249 ****
22c937
--- 2247,2256 ----
22c937
  /* Character used as separated in autoload function/variable names. */
22c937
  #define AUTOLOAD_CHAR '#'
22c937
  
22c937
+ #ifdef FEAT_EVAL
22c937
+ # define SET_NO_HLSEARCH(flag) no_hlsearch = (flag); set_vim_var_nr(VV_HLSEARCH, !no_hlsearch)
22c937
+ #else
22c937
+ # define SET_NO_HLSEARCH(flag) no_hlsearch = (flag)
22c937
+ #endif
22c937
+ 
22c937
  #endif /* VIM__H */
22c937
*** ../vim-7.4.078/src/testdir/test101.in	2013-11-08 04:28:49.000000000 +0100
22c937
--- src/testdir/test101.in	2013-11-08 04:11:46.000000000 +0100
22c937
***************
22c937
*** 0 ****
22c937
--- 1,45 ----
22c937
+ Test for v:hlsearch     vim: set ft=vim :
22c937
+ 
22c937
+ STARTTEST
22c937
+ :" Last abc: Q
22c937
+ :so small.vim
22c937
+ :new
22c937
+ :call setline(1, repeat(['aaa'], 10))
22c937
+ :set hlsearch nolazyredraw
22c937
+ :let r=[]
22c937
+ :command -nargs=0 -bar AddR :call add(r, [screenattr(1, 1), v:hlsearch])
22c937
+ /aaa
22c937
+ :AddR
22c937
+ :nohlsearch
22c937
+ :AddR
22c937
+ :let v:hlsearch=1
22c937
+ :AddR
22c937
+ :let v:hlsearch=0
22c937
+ :AddR
22c937
+ :set hlsearch
22c937
+ :AddR
22c937
+ :let v:hlsearch=0
22c937
+ :AddR
22c937
+ n:AddR
22c937
+ :let v:hlsearch=0
22c937
+ :AddR
22c937
+ /
22c937
+ :AddR
22c937
+ :let r1=r[0][0]
22c937
+ :" I guess it is not guaranteed that screenattr outputs always the same character
22c937
+ :call map(r, 'v:val[1].":".(v:val[0]==r1?"highlighted":"not highlighted")')
22c937
+ :try
22c937
+ :   let v:hlsearch=[]
22c937
+ :catch
22c937
+ :   call add(r, matchstr(v:exception,'^Vim(let):E\d\+:'))
22c937
+ :endtry
22c937
+ :bwipeout!
22c937
+ :$put=r
22c937
+ :call garbagecollect(1)
22c937
+ :"
22c937
+ :/^start:/,$wq! test.out
22c937
+ :" vim: et ts=4 isk-=\:
22c937
+ :call getchar()
22c937
+ ENDTEST
22c937
+ 
22c937
+ start:
22c937
*** ../vim-7.4.078/src/testdir/test101.ok	2013-11-08 04:28:49.000000000 +0100
22c937
--- src/testdir/test101.ok	2013-11-08 04:11:46.000000000 +0100
22c937
***************
22c937
*** 0 ****
22c937
--- 1,11 ----
22c937
+ start:
22c937
+ 1:highlighted
22c937
+ 0:not highlighted
22c937
+ 1:highlighted
22c937
+ 0:not highlighted
22c937
+ 1:highlighted
22c937
+ 0:not highlighted
22c937
+ 1:highlighted
22c937
+ 0:not highlighted
22c937
+ 1:highlighted
22c937
+ Vim(let):E706:
22c937
*** ../vim-7.4.078/src/testdir/Make_amiga.mak	2013-11-07 03:25:51.000000000 +0100
22c937
--- src/testdir/Make_amiga.mak	2013-11-08 04:22:13.000000000 +0100
22c937
***************
22c937
*** 34,40 ****
22c937
  		test81.out test82.out test83.out test84.out test88.out \
22c937
  		test89.out test90.out test91.out test92.out test93.out \
22c937
  		test94.out test95.out test96.out test97.out test98.out \
22c937
! 		test99.out test100.out
22c937
  
22c937
  .SUFFIXES: .in .out
22c937
  
22c937
--- 34,40 ----
22c937
  		test81.out test82.out test83.out test84.out test88.out \
22c937
  		test89.out test90.out test91.out test92.out test93.out \
22c937
  		test94.out test95.out test96.out test97.out test98.out \
22c937
! 		test99.out test100.out test101.out
22c937
  
22c937
  .SUFFIXES: .in .out
22c937
  
22c937
***************
22c937
*** 151,153 ****
22c937
--- 151,154 ----
22c937
  test98.out: test98.in
22c937
  test99.out: test99.in
22c937
  test100.out: test100.in
22c937
+ test101.out: test101.in
22c937
*** ../vim-7.4.078/src/testdir/Make_dos.mak	2013-11-07 03:25:51.000000000 +0100
22c937
--- src/testdir/Make_dos.mak	2013-11-08 04:22:17.000000000 +0100
22c937
***************
22c937
*** 33,39 ****
22c937
  		test84.out test85.out test86.out test87.out test88.out \
22c937
  		test89.out test90.out test91.out test92.out test93.out \
22c937
  		test94.out test95.out test96.out test98.out test99.out \
22c937
! 		test100.out
22c937
  
22c937
  SCRIPTS32 =	test50.out test70.out
22c937
  
22c937
--- 33,39 ----
22c937
  		test84.out test85.out test86.out test87.out test88.out \
22c937
  		test89.out test90.out test91.out test92.out test93.out \
22c937
  		test94.out test95.out test96.out test98.out test99.out \
22c937
! 		test100.out test101.out
22c937
  
22c937
  SCRIPTS32 =	test50.out test70.out
22c937
  
22c937
*** ../vim-7.4.078/src/testdir/Make_ming.mak	2013-11-07 03:25:51.000000000 +0100
22c937
--- src/testdir/Make_ming.mak	2013-11-08 04:22:19.000000000 +0100
22c937
***************
22c937
*** 53,59 ****
22c937
  		test84.out test85.out test86.out test87.out test88.out \
22c937
  		test89.out test90.out test91.out test92.out test93.out \
22c937
  		test94.out test95.out test96.out test98.out test99.out \
22c937
! 		test100out
22c937
  
22c937
  SCRIPTS32 =	test50.out test70.out
22c937
  
22c937
--- 53,59 ----
22c937
  		test84.out test85.out test86.out test87.out test88.out \
22c937
  		test89.out test90.out test91.out test92.out test93.out \
22c937
  		test94.out test95.out test96.out test98.out test99.out \
22c937
! 		test100out test101.out
22c937
  
22c937
  SCRIPTS32 =	test50.out test70.out
22c937
  
22c937
*** ../vim-7.4.078/src/testdir/Make_os2.mak	2013-11-07 03:25:51.000000000 +0100
22c937
--- src/testdir/Make_os2.mak	2013-11-08 04:22:21.000000000 +0100
22c937
***************
22c937
*** 35,41 ****
22c937
  		test81.out test82.out test83.out test84.out test88.out \
22c937
  		test89.out test90.out test91.out test92.out test93.out \
22c937
  		test94.out test95.out test96.out test98.out test99.out \
22c937
! 		test100.out
22c937
  
22c937
  .SUFFIXES: .in .out
22c937
  
22c937
--- 35,41 ----
22c937
  		test81.out test82.out test83.out test84.out test88.out \
22c937
  		test89.out test90.out test91.out test92.out test93.out \
22c937
  		test94.out test95.out test96.out test98.out test99.out \
22c937
! 		test100.out test101.out
22c937
  
22c937
  .SUFFIXES: .in .out
22c937
  
22c937
*** ../vim-7.4.078/src/testdir/Make_vms.mms	2013-11-07 03:25:51.000000000 +0100
22c937
--- src/testdir/Make_vms.mms	2013-11-08 04:22:23.000000000 +0100
22c937
***************
22c937
*** 4,10 ****
22c937
  # Authors:	Zoltan Arpadffy, <arpadffy@polarhome.com>
22c937
  #		Sandor Kopanyi,  <sandor.kopanyi@mailbox.hu>
22c937
  #
22c937
! # Last change:  2013 Nov 07
22c937
  #
22c937
  # This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
22c937
  # Edit the lines in the Configuration section below to select.
22c937
--- 4,10 ----
22c937
  # Authors:	Zoltan Arpadffy, <arpadffy@polarhome.com>
22c937
  #		Sandor Kopanyi,  <sandor.kopanyi@mailbox.hu>
22c937
  #
22c937
! # Last change:  2013 Nov 08
22c937
  #
22c937
  # This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
22c937
  # Edit the lines in the Configuration section below to select.
22c937
***************
22c937
*** 79,85 ****
22c937
  	 test82.out test83.out test84.out test88.out test89.out \
22c937
  	 test90.out test91.out test92.out test93.out test94.out \
22c937
  	 test95.out test96.out test97.out test98.out test99.out \
22c937
! 	 test100.out
22c937
  
22c937
  # Known problems:
22c937
  # Test 30: a problem around mac format - unknown reason
22c937
--- 79,85 ----
22c937
  	 test82.out test83.out test84.out test88.out test89.out \
22c937
  	 test90.out test91.out test92.out test93.out test94.out \
22c937
  	 test95.out test96.out test97.out test98.out test99.out \
22c937
! 	 test100.out test101.out
22c937
  
22c937
  # Known problems:
22c937
  # Test 30: a problem around mac format - unknown reason
22c937
*** ../vim-7.4.078/src/testdir/Makefile	2013-11-07 03:25:51.000000000 +0100
22c937
--- src/testdir/Makefile	2013-11-08 04:22:26.000000000 +0100
22c937
***************
22c937
*** 30,36 ****
22c937
  		test84.out test85.out test86.out test87.out test88.out \
22c937
  		test89.out test90.out test91.out test92.out test93.out \
22c937
  		test94.out test95.out test96.out test97.out test98.out \
22c937
! 		test99.out test100.out
22c937
  
22c937
  SCRIPTS_GUI = test16.out
22c937
  
22c937
--- 30,36 ----
22c937
  		test84.out test85.out test86.out test87.out test88.out \
22c937
  		test89.out test90.out test91.out test92.out test93.out \
22c937
  		test94.out test95.out test96.out test97.out test98.out \
22c937
! 		test99.out test100.out test101.out
22c937
  
22c937
  SCRIPTS_GUI = test16.out
22c937
  
22c937
*** ../vim-7.4.078/src/version.c	2013-11-08 03:15:39.000000000 +0100
22c937
--- src/version.c	2013-11-08 04:11:08.000000000 +0100
22c937
***************
22c937
*** 740,741 ****
22c937
--- 740,743 ----
22c937
  {   /* Add new patch number below this line */
22c937
+ /**/
22c937
+     79,
22c937
  /**/
22c937
22c937
-- 
22c937
Corn oil comes from corn and olive oil comes from olives, so where
22c937
does baby oil come from?
22c937
22c937
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
22c937
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
22c937
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
22c937
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///