Vim: Vim Conceal Newline Bug

Created on 5 Mar 2019  路  4Comments  路  Source: vim/vim

If you open new vim session with one file, then you use call matchadd('Conceal', "\n") as well as set conceallevel=3 concealcursor+=n everything you search will disappear using a vimrc such as this one: http://ix.io/1CCS

Version: 8.1 1-991 and 8.1 1-996

Edit: Apparently incsearch and hlsearch must be enabled at the same time.

Edit: it doesn't have to be the first window. :call matchadd('Conceal', "\n") | set conceallevel=3 concealcursor=nvic hlsearch incsearch simply needs to be called then a search issued.

asciicast

All 4 comments

Possibly the same as #2185 (closed without fix). Note that incsearch is not actually required, only hlsearch.

The following change seems to fix it, but I don't pretend to understand this code enough to know what other consequences it has.

--- a/src/screen.c
+++ b/src/screen.c
@@ -4138,7 +4138,7 @@ win_line(
                            shl->attr_cur = shl->attr;
 #ifdef FEAT_CONCEAL
                            if (cur != NULL && syn_name2id((char_u *)"Conceal")
-                                                              == cur->hlg_id)
+                                         == cur->hlg_id && shl != &search_hl)
                            {
                                has_match_conc =
                                             v == (long)shl->startcol ? 2 : 1;

@andymass ah thanks. I was about to close the issue after saying that setting the priority to -1 "fixes" the issue. But I'll leave it open for now for further review since you have a patch. thanks

I'll include the fix, but it would be nice to also have a test to verify this.

Was this page helpful?
0 / 5 - 0 ratings