To: vim_dev@googlegroups.com Subject: Patch 8.0.1768 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1768 Problem: SET_NO_HLSEARCH() used in a wrong way. Solution: Make it a function. (suggested by Dominique Pelle, closes #2850) Files: src/vim.h, src/ex_docmd.c, src/proto/ex_docmd.pro, src/search.c, src/ex_getln.c, src/option.c, src/screen.c, src/tag.c *** ../vim-8.0.1767/src/vim.h 2018-04-23 20:46:11.758227134 +0200 --- src/vim.h 2018-04-27 22:42:17.074483541 +0200 *************** *** 2458,2469 **** /* 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 --- 2458,2463 ---- *** ../vim-8.0.1767/src/ex_docmd.c 2018-04-05 18:56:42.394258079 +0200 --- src/ex_docmd.c 2018-04-27 22:52:40.390732919 +0200 *************** *** 12193,12206 **** (void)do_set(eap->arg, flags); } ! #ifdef FEAT_SEARCH_EXTRA /* * ":nohlsearch" */ static void ex_nohlsearch(exarg_T *eap UNUSED) { ! SET_NO_HLSEARCH(TRUE); redraw_all_later(SOME_VALID); } --- 12193,12215 ---- (void)do_set(eap->arg, flags); } ! #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); redraw_all_later(SOME_VALID); } *** ../vim-8.0.1767/src/proto/ex_docmd.pro 2018-04-04 22:57:24.109853647 +0200 --- src/proto/ex_docmd.pro 2018-04-27 22:45:00.161505983 +0200 *************** *** 66,71 **** --- 66,72 ---- 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 : */ *** ../vim-8.0.1767/src/search.c 2018-04-24 15:19:00.507068755 +0200 --- src/search.c 2018-04-27 22:44:25.849711947 +0200 *************** *** 293,299 **** /* If 'hlsearch' set and search pat changed: need redraw. */ if (p_hls) redraw_all_later(SOME_VALID); ! SET_NO_HLSEARCH(FALSE); #endif } } --- 293,299 ---- /* If 'hlsearch' set and search pat changed: need redraw. */ if (p_hls) redraw_all_later(SOME_VALID); ! set_no_hlsearch(FALSE); #endif } } *************** *** 336,342 **** spats[1] = saved_spats[1]; #ifdef FEAT_SEARCH_EXTRA last_idx = saved_last_idx; ! SET_NO_HLSEARCH(saved_no_hlsearch); #endif } } --- 336,342 ---- spats[1] = saved_spats[1]; #ifdef FEAT_SEARCH_EXTRA last_idx = saved_last_idx; ! set_no_hlsearch(saved_no_hlsearch); #endif } } *************** *** 387,393 **** set_vv_searchforward(); # endif last_idx = saved_last_idx; ! SET_NO_HLSEARCH(saved_no_hlsearch); } char_u * --- 387,393 ---- set_vv_searchforward(); # endif last_idx = saved_last_idx; ! set_no_hlsearch(saved_no_hlsearch); } char_u * *************** *** 1282,1288 **** if (no_hlsearch && !(options & SEARCH_KEEP)) { redraw_all_later(SOME_VALID); ! SET_NO_HLSEARCH(FALSE); } #endif --- 1282,1288 ---- if (no_hlsearch && !(options & SEARCH_KEEP)) { redraw_all_later(SOME_VALID); ! set_no_hlsearch(FALSE); } #endif *************** *** 5757,5765 **** spats[idx].off.off = off; #ifdef FEAT_SEARCH_EXTRA if (setlast) ! { ! SET_NO_HLSEARCH(!hlsearch_on); ! } #endif } } --- 5757,5763 ---- spats[idx].off.off = off; #ifdef FEAT_SEARCH_EXTRA if (setlast) ! set_no_hlsearch(!hlsearch_on); #endif } } *** ../vim-8.0.1767/src/ex_getln.c 2018-04-27 22:17:52.171019734 +0200 --- src/ex_getln.c 2018-04-27 22:46:28.728973712 +0200 *************** *** 1976,1982 **** if (ccline.cmdlen == 0) { i = 0; ! SET_NO_HLSEARCH(TRUE); /* turn off previous highlight */ redraw_all_later(SOME_VALID); } else --- 1976,1982 ---- if (ccline.cmdlen == 0) { i = 0; ! set_no_hlsearch(TRUE); /* turn off previous highlight */ redraw_all_later(SOME_VALID); } else *************** *** 2045,2051 **** /* Disable 'hlsearch' highlighting if the pattern matches * everything. Avoids a flash when typing "foo\|". */ if (empty_pattern(ccline.cmdbuff)) ! SET_NO_HLSEARCH(TRUE); validate_cursor(); /* May redraw the status line to show the cursor position. */ --- 2045,2051 ---- /* Disable 'hlsearch' highlighting if the pattern matches * everything. Avoids a flash when typing "foo\|". */ if (empty_pattern(ccline.cmdbuff)) ! set_no_hlsearch(TRUE); validate_cursor(); /* May redraw the status line to show the cursor position. */ *** ../vim-8.0.1767/src/option.c 2018-04-24 20:23:51.597624727 +0200 --- src/option.c 2018-04-27 22:43:48.713934696 +0200 *************** *** 8359,8365 **** /* when 'hlsearch' is set or reset: reset no_hlsearch */ else if ((int *)varp == &p_hls) { ! SET_NO_HLSEARCH(FALSE); } #endif --- 8359,8365 ---- /* when 'hlsearch' is set or reset: reset no_hlsearch */ else if ((int *)varp == &p_hls) { ! set_no_hlsearch(FALSE); } #endif *** ../vim-8.0.1767/src/screen.c 2018-04-13 20:41:24.856374986 +0200 --- src/screen.c 2018-04-27 22:43:58.769874394 +0200 *************** *** 7945,7951 **** { /* don't free regprog in the match list, it's a copy */ vim_regfree(shl->rm.regprog); ! SET_NO_HLSEARCH(TRUE); } shl->rm.regprog = NULL; shl->lnum = 0; --- 7945,7951 ---- { /* don't free regprog in the match list, it's a copy */ vim_regfree(shl->rm.regprog); ! set_no_hlsearch(TRUE); } shl->rm.regprog = NULL; shl->lnum = 0; *** ../vim-8.0.1767/src/tag.c 2018-03-04 18:07:04.284592244 +0100 --- src/tag.c 2018-04-27 22:44:39.589629488 +0200 *************** *** 3409,3417 **** #ifdef FEAT_SEARCH_EXTRA /* restore no_hlsearch when keeping the old search pattern */ if (search_options) ! { ! SET_NO_HLSEARCH(save_no_hlsearch); ! } #endif /* Return OK if jumped to another file (at least we found the file!). */ --- 3409,3415 ---- #ifdef FEAT_SEARCH_EXTRA /* restore no_hlsearch when keeping the old search pattern */ if (search_options) ! set_no_hlsearch(save_no_hlsearch); #endif /* Return OK if jumped to another file (at least we found the file!). */ *** ../vim-8.0.1767/src/version.c 2018-04-27 22:17:52.171019734 +0200 --- src/version.c 2018-04-27 22:52:14.174891264 +0200 *************** *** 763,764 **** --- 763,766 ---- { /* Add new patch number below this line */ + /**/ + 1768, /**/ -- Facepalm statement #5: "Petrol getting more expensive? Not for me, I'm always tanking for 20 dollars" /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///