diff options
author | KillTheMule <KillTheMule@users.noreply.github.com> | 2017-09-30 23:20:28 +0200 |
---|---|---|
committer | KillTheMule <KillTheMule@users.noreply.github.com> | 2017-10-29 18:11:32 +0100 |
commit | 353c81af1e3cea8d32f834def9ffcbae86c5c727 (patch) | |
tree | 1885c0716b98c113c3a5743af2131f1faab0f802 /src | |
parent | be20b20cf3a845abf8e62f005a9ccbb0cde03e7d (diff) | |
download | rneovim-353c81af1e3cea8d32f834def9ffcbae86c5c727.tar.gz rneovim-353c81af1e3cea8d32f834def9ffcbae86c5c727.tar.bz2 rneovim-353c81af1e3cea8d32f834def9ffcbae86c5c727.zip |
Clear highlight when there's no match
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ex_cmds.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index b9f14f27ea..baf2595772 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -4052,7 +4052,7 @@ skip: if (got_quit) { // Substitution is too slow, disable 'inccommand'. set_string_option_direct((char_u *)"icm", -1, (char_u *)"", OPT_FREE, SID_NONE); - } else if (*p_icm != NUL && subsize != 0 && pat != NULL) { + } else if (*p_icm != NUL && pat != NULL) { if (pre_src_id == 0) { // Get a unique new src_id, saved in a static pre_src_id = bufhl_add_hl(NULL, 0, -1, 0, 0, 0); @@ -4063,8 +4063,10 @@ skip: curbuf->b_changed = save_b_changed; // preserve 'modified' during preview preview_buf = show_sub(eap, old_cursor, &preview_lines, has_second_delim, pre_hl_id, pre_src_id); - bufhl_clear_line_range(orig_buf, pre_src_id, eap->line1, - kv_last(preview_lines.subresults).end.lnum); + if (subsize > 0) { + bufhl_clear_line_range(orig_buf, pre_src_id, eap->line1, + kv_last(preview_lines.subresults).end.lnum); + } } } @@ -6128,9 +6130,11 @@ static buf_T *show_sub(exarg_T *eap, pos_T old_cusr, curwin->w_p_spell = false; curwin->w_p_fen = false; - // Width of the "| lnum|..." column which displays the line numbers. - highest_num_line = kv_last(lines.subresults).end.lnum; - col_width = log10(highest_num_line) + 1 + 3; + if (lines.subresults.size > 0) { + // Width of the "| lnum|..." column which displays the line numbers. + highest_num_line = kv_last(lines.subresults).end.lnum; + col_width = log10(highest_num_line) + 1 + 3; + } } char *str = NULL; // construct the line to show in here |