diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-11-13 12:54:50 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-11-13 12:54:50 +0000 |
commit | 2f7bfe66a1373051792f2ecaeefb66049825221d (patch) | |
tree | a01ffdeb5ba2e585050981645c4473e9b87fea46 /src | |
parent | 28c56d501352bd98472d23667bade683877cadcc (diff) |
patch 9.0.0870: get E967 when using text property in quickfix windowv9.0.0870
Problem: Get E967 when using text property in quickfix window. (Sergey
Vlasov)
Solution: Do not add an extra NUL and compute the text length correctly.
(closes #11513)
Diffstat (limited to 'src')
-rw-r--r-- | src/quickfix.c | 10 | ||||
-rw-r--r-- | src/testdir/test_textprop.vim | 27 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 35 insertions, 4 deletions
diff --git a/src/quickfix.c b/src/quickfix.c index f85fff56f2..403c397d53 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -4645,7 +4645,10 @@ qf_buf_add_line( // If the 'quickfixtextfunc' function returned a non-empty custom string // for this entry, then use it. if (qftf_str != NULL && *qftf_str != NUL) + { ga_concat(gap, qftf_str); + ga_append(gap, NUL); + } else { if (qfp->qf_module != NULL) @@ -4687,12 +4690,11 @@ qf_buf_add_line( // Remove newlines and leading whitespace from the text. // For an unrecognized line keep the indent, the compiler may // mark a word with ^^^^. - qf_fmt_text(gap, gap->ga_len > 3 ? skipwhite(qfp->qf_text) : qfp->qf_text); + qf_fmt_text(gap, gap->ga_len > 3 ? skipwhite(qfp->qf_text) + : qfp->qf_text); } - ga_append(gap, NUL); - - if (ml_append_buf(buf, lnum, gap->ga_data, gap->ga_len + 1, FALSE) == FAIL) + if (ml_append_buf(buf, lnum, gap->ga_data, gap->ga_len, FALSE) == FAIL) return FAIL; return OK; diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim index 7ec5998dab..ac2be259a7 100644 --- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -3434,4 +3434,31 @@ func Test_insert_text_change_arg() call StopVimInTerminal(buf) endfunc +def Test_textprop_in_quickfix_window() + enew! + var prop_type = 'my_prop' + prop_type_add(prop_type, {}) + + for lnum in range(1, 10) + setline(lnum, 'hello world') + endfor + + cgetbuffer + copen + + var bufnr = bufnr() + for lnum in range(1, line('$', bufnr->bufwinid())) + prop_add(lnum, 1, { + id: 1000 + lnum, + type: prop_type, + bufnr: bufnr, + }) + endfor + + prop_type_delete(prop_type) + cclose + bwipe! +enddef + + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index 10aa6dedcc..73c106e1d2 100644 --- a/src/version.c +++ b/src/version.c @@ -696,6 +696,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 870, +/**/ 869, /**/ 868, |