aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-01-16 22:02:14 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-01-17 12:42:28 -0500
commit402f2bda131d4f5aeb33957766ffb0523f43c879 (patch)
treee7a4683882415ecefbd576655cf0459f3e575ec3 /src
parent6a01b3fcc361960e559db459e1524418bc76dd66 (diff)
downloadrneovim-402f2bda131d4f5aeb33957766ffb0523f43c879.tar.gz
rneovim-402f2bda131d4f5aeb33957766ffb0523f43c879.tar.bz2
rneovim-402f2bda131d4f5aeb33957766ffb0523f43c879.zip
vim-patch:8.2.2361: Vim9: no highlight for "s///gc" when using 'opfunc'
Problem: Vim9: no highlight for "s///gc" when using 'opfunc'. Solution: Reset 'lazyredraw' temporarily. (closes vim/vim#7687) https://github.com/vim/vim/commit/7c886db915035bc064ca307f02c34ae9d99cc733
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_cmds.c7
-rw-r--r--src/nvim/ex_getln.c2
-rw-r--r--src/nvim/search.c87
3 files changed, 54 insertions, 42 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 61e4d634c6..a2487336f1 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -3693,6 +3693,7 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
} else {
char_u *orig_line = NULL;
int len_change = 0;
+ const bool save_p_lz = p_lz;
int save_p_fen = curwin->w_p_fen;
curwin->w_p_fen = FALSE;
@@ -3701,6 +3702,9 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
int temp = RedrawingDisabled;
RedrawingDisabled = 0;
+ // avoid calling update_screen() in vgetorpeek()
+ p_lz = false;
+
if (new_start != NULL) {
/* There already was a substitution, we would
* like to show this to the user. We cannot
@@ -3754,7 +3758,8 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
/* clear the question */
msg_didout = FALSE; /* don't scroll up */
msg_col = 0;
- gotocmdline(TRUE);
+ gotocmdline(true);
+ p_lz = save_p_lz;
// restore the line
if (orig_line != NULL) {
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 626b840798..2aa66f6a8c 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -3828,7 +3828,7 @@ static void cmd_cursor_goto(int row, int col)
ui_grid_cursor_goto(grid->handle, row, col);
}
-void gotocmdline(int clr)
+void gotocmdline(bool clr)
{
if (ui_has(kUICmdline)) {
return;
diff --git a/src/nvim/search.c b/src/nvim/search.c
index 787a464070..2802da6f7f 100644
--- a/src/nvim/search.c
+++ b/src/nvim/search.c
@@ -4497,9 +4497,9 @@ find_pattern_in_path(
regmatch_T regmatch;
regmatch_T incl_regmatch;
regmatch_T def_regmatch;
- int matched = FALSE;
- int did_show = FALSE;
- int found = FALSE;
+ bool matched = false;
+ bool did_show = false;
+ bool found = false;
int i;
char_u *already = NULL;
char_u *startp = NULL;
@@ -4611,7 +4611,7 @@ find_pattern_in_path(
}
MSG_PUTS_TITLE(_("in path ---\n"));
}
- did_show = TRUE;
+ did_show = true;
while (depth_displayed < depth && !got_int) {
++depth_displayed;
for (i = 0; i < depth_displayed; i++)
@@ -4761,10 +4761,10 @@ search_line:
matched = !STRNCMP(startp, ptr, len);
if (matched && define_matched && whole
&& vim_iswordc(startp[len]))
- matched = FALSE;
+ matched = false;
} else if (regmatch.regprog != NULL
&& vim_regexec(&regmatch, line, (colnr_T)(p - line))) {
- matched = TRUE;
+ matched = true;
startp = regmatch.startp[0];
// Check if the line is not a comment line (unless we are
// looking for a define). A line starting with "# define"
@@ -4789,15 +4789,16 @@ search_line:
if (matched
&& p[0] == '/'
&& (p[1] == '*' || p[1] == '/')) {
- matched = FALSE;
- /* After "//" all text is comment */
- if (p[1] == '/')
+ matched = false;
+ // After "//" all text is comment
+ if (p[1] == '/') {
break;
- ++p;
+ }
+ p++;
} else if (!matched && p[0] == '*' && p[1] == '/') {
- /* Can find match after "* /". */
- matched = TRUE;
- ++p;
+ // Can find match after "* /".
+ matched = true;
+ p++;
}
}
}
@@ -4811,7 +4812,7 @@ search_line:
if (depth == -1 && lnum == curwin->w_cursor.lnum)
break;
- found = TRUE;
+ found = true;
aux = p = startp;
if (compl_cont_status & CONT_ADDING) {
p += compl_length;
@@ -4879,9 +4880,10 @@ search_line:
break;
}
} else if (action == ACTION_SHOW_ALL) {
- found = TRUE;
- if (!did_show)
- gotocmdline(TRUE); /* cursor at status line */
+ found = true;
+ if (!did_show) {
+ gotocmdline(true); // cursor at status line
+ }
if (curr_fname != prev_fname) {
if (did_show)
msg_putchar('\n'); /* cursor below last one */
@@ -4890,28 +4892,28 @@ search_line:
msg_home_replace_hl(curr_fname);
prev_fname = curr_fname;
}
- did_show = TRUE;
- if (!got_int)
- show_pat_in_path(line, type, TRUE, action,
- (depth == -1) ? NULL : files[depth].fp,
- (depth == -1) ? &lnum : &files[depth].lnum,
- match_count++);
+ did_show = true;
+ if (!got_int) {
+ show_pat_in_path(line, type, true, action,
+ (depth == -1) ? NULL : files[depth].fp,
+ (depth == -1) ? &lnum : &files[depth].lnum,
+ match_count++);
+ }
/* Set matched flag for this file and all the ones that
* include it */
for (i = 0; i <= depth; ++i)
files[i].matched = TRUE;
} else if (--count <= 0) {
- found = TRUE;
+ found = true;
if (depth == -1 && lnum == curwin->w_cursor.lnum
- && l_g_do_tagpreview == 0
- )
+ && l_g_do_tagpreview == 0) {
EMSG(_("E387: Match is on current line"));
- else if (action == ACTION_SHOW) {
+ } else if (action == ACTION_SHOW) {
show_pat_in_path(line, type, did_show, action,
- (depth == -1) ? NULL : files[depth].fp,
- (depth == -1) ? &lnum : &files[depth].lnum, 1L);
- did_show = TRUE;
+ (depth == -1) ? NULL : files[depth].fp,
+ (depth == -1) ? &lnum : &files[depth].lnum, 1L);
+ did_show = true;
} else {
/* ":psearch" uses the preview window */
if (l_g_do_tagpreview != 0) {
@@ -4960,15 +4962,16 @@ search_line:
break;
}
exit_matched:
- matched = FALSE;
- /* look for other matches in the rest of the line if we
- * are not at the end of it already */
+ matched = false;
+ // look for other matches in the rest of the line if we
+ // are not at the end of it already
if (def_regmatch.regprog == NULL
&& action == ACTION_EXPAND
&& !(compl_cont_status & CONT_SOL)
&& *startp != NUL
- && *(p = startp + utfc_ptr2len(startp)) != NUL)
+ && *(p = startp + utfc_ptr2len(startp)) != NUL) {
goto search_line;
+ }
}
line_breakcheck();
if (action == ACTION_EXPAND)
@@ -5046,16 +5049,20 @@ fpip_end:
vim_regfree(def_regmatch.regprog);
}
-static void show_pat_in_path(char_u *line, int type, int did_show, int action, FILE *fp, linenr_T *lnum, long count)
+static void show_pat_in_path(char_u *line, int type, bool did_show, int action,
+ FILE *fp, linenr_T *lnum, long count)
+ FUNC_ATTR_NONNULL_ARG(1, 6)
{
char_u *p;
- if (did_show)
- msg_putchar('\n'); /* cursor below last one */
- else if (!msg_silent)
- gotocmdline(TRUE); /* cursor at status line */
- if (got_int) /* 'q' typed at "--more--" message */
+ if (did_show) {
+ msg_putchar('\n'); // cursor below last one
+ } else if (!msg_silent) {
+ gotocmdline(true); // cursor at status line
+ }
+ if (got_int) { // 'q' typed at "--more--" message
return;
+ }
for (;; ) {
p = line + STRLEN(line) - 1;
if (fp != NULL) {