To: vim_dev@googlegroups.com Subject: Patch 8.0.1393 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1393 Problem: Too much highlighting with 'hlsearch' and 'incsearch' set. Solution: Do not highlight matches when the pattern matches everything. Files: src/ex_getln.c *** ../vim-8.0.1392/src/ex_getln.c 2017-11-28 20:47:36.782817313 +0100 --- src/ex_getln.c 2017-12-16 16:32:49.971506801 +0100 *************** *** 173,178 **** --- 173,194 ---- } /* + * Guess that the pattern matches everything. Only finds specific cases, such + * as a trailing \|, which can happen while typing a pattern. + */ + static int + empty_pattern(char_u *p) + { + int n = STRLEN(p); + + /* remove trailing \v and the like */ + while (n >= 2 && p[n - 2] == '\\' + && vim_strchr((char_u *)"mMvVcCZ", p[n - 1]) != NULL) + n -= 2; + return n == 0 || (n >= 2 && p[n - 2] == '\\' && p[n - 1] == '|'); + } + + /* * getcmdline() - accept a command line starting with firstc. * * firstc == ':' get ":" command line. *************** *** 2023,2028 **** --- 2039,2049 ---- else end_pos = curwin->w_cursor; /* shutup gcc 4 */ + /* 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. */ if (p_ru && curwin->w_status_height > 0) *** ../vim-8.0.1392/src/version.c 2017-12-16 14:37:02.453279355 +0100 --- src/version.c 2017-12-16 16:28:15.765332710 +0100 *************** *** 773,774 **** --- 773,776 ---- { /* Add new patch number below this line */ + /**/ + 1393, /**/ -- hundred-and-one symptoms of being an internet addict: 108. While reading a magazine, you look for the Zoom icon for a better look at a photograph. /// 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 ///