]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.0870: get E967 when using text property in quickfix window v9.0.0870
authorBram Moolenaar <Bram@vim.org>
Sun, 13 Nov 2022 12:54:50 +0000 (12:54 +0000)
committerBram Moolenaar <Bram@vim.org>
Sun, 13 Nov 2022 12:54:50 +0000 (12:54 +0000)
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)

src/quickfix.c
src/testdir/test_textprop.vim
src/version.c

index f85fff56f23de4dc94ecfad62704368a7292cd53..403c397d53f9e9d3576c8eb173e1a56ac0fd0890 100644 (file)
@@ -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;
index 7ec5998dabc2fd478fb4ade409fe0e6dfc596801..ac2be259a75b8eeee889fba2fc518171035563e7 100644 (file)
@@ -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
index 10aa6dedcc3aad47c3a050b9126fbd83cc58b8ab..73c106e1d2323f41a2cb82636d4ce76723b4830d 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    870,
 /**/
     869,
 /**/