summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-07-28 11:56:01 +0100
committerBram Moolenaar <Bram@vim.org>2022-07-28 11:56:01 +0100
commit5f30e26f6946f0d0396499f91fbcfaa9d1f8acf7 (patch)
treef03f65ea914cec1bec389ca1e51f3bd6612061b4
parentf6782732ab4acd02211923fbdccb457dacaf277e (diff)
downloadvim-git-9.0.0097.tar.gz
patch 9.0.0097: long quickfix line is truncated for :clistv9.0.0097
Problem: Long quickfix line is truncated for :clist. Solution: Allocate a buffer if needed.
-rw-r--r--src/quickfix.c32
-rw-r--r--src/testdir/test_quickfix.vim8
-rw-r--r--src/version.c2
3 files changed, 35 insertions, 7 deletions
diff --git a/src/quickfix.c b/src/quickfix.c
index 49484e060..b9b908cc0 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -3622,13 +3622,31 @@ qf_list_entry(qfline_T *qfp, int qf_idx, int cursel)
}
msg_puts(" ");
- // 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((fname != NULL || qfp->qf_lnum != 0)
- ? skipwhite(qfp->qf_text) : qfp->qf_text,
- IObuff, IOSIZE);
- msg_prt_line(IObuff, FALSE);
+ {
+ char_u *tbuf = IObuff;
+ size_t tbuflen = IOSIZE;
+ size_t len = STRLEN(qfp->qf_text) + 3;
+
+ if (len > IOSIZE)
+ {
+ tbuf = alloc(len);
+ if (tbuf != NULL)
+ tbuflen = len;
+ else
+ tbuf = IObuff;
+ }
+
+ // 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((fname != NULL || qfp->qf_lnum != 0)
+ ? skipwhite(qfp->qf_text) : qfp->qf_text,
+ tbuf, tbuflen);
+ msg_prt_line(tbuf, FALSE);
+
+ if (tbuf != IObuff)
+ vim_free(tbuf);
+ }
out_flush(); // show one line at a time
}
diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim
index 2431a46fc..94651af81 100644
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -185,6 +185,14 @@ func XlistTests(cchar)
\ ' 2 Data.Text:20 col 10 warning 22: ModuleWarning',
\ ' 3 Data/Text.hs:30 col 15 warning 33: FileWarning'], l)
+ " Very long line should be displayed.
+ let text = 'Line' .. repeat('1234567890', 130)
+ let lines = ['Xtestfile9:2:9:' .. text]
+ Xgetexpr lines
+
+ let l = split(execute('Xlist', ''), "\n")
+ call assert_equal([' 1 Xtestfile9:2 col 9: ' .. text] , l)
+
" For help entries in the quickfix list, only the filename without directory
" should be displayed
Xhelpgrep setqflist()
diff --git a/src/version.c b/src/version.c
index 967f7aa00..08152ad0c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -736,6 +736,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 97,
+/**/
96,
/**/
95,