aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/quickfix.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-28 19:49:18 +0800
committerGitHub <noreply@github.com>2022-07-28 19:49:18 +0800
commit9cb8b5f8dbef6c81d287639726e425d80c15c70d (patch)
treecb908e25444cdfbcd457a9d46fc2dfd0d389122a /src/nvim/quickfix.c
parentb4e12bfa0044720b39fc08c18149167b3ca9b255 (diff)
downloadrneovim-9cb8b5f8dbef6c81d287639726e425d80c15c70d.tar.gz
rneovim-9cb8b5f8dbef6c81d287639726e425d80c15c70d.tar.bz2
rneovim-9cb8b5f8dbef6c81d287639726e425d80c15c70d.zip
vim-patch:9.0.0097: long quickfix line is truncated for :clist (#19561)
Problem: Long quickfix line is truncated for :clist. Solution: Allocate a buffer if needed. https://github.com/vim/vim/commit/5f30e26f6946f0d0396499f91fbcfaa9d1f8acf7
Diffstat (limited to 'src/nvim/quickfix.c')
-rw-r--r--src/nvim/quickfix.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index 2138437b29..d5797e87e5 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -3147,13 +3147,31 @@ static void qf_list_entry(qfline_T *qfp, int qf_idx, bool cursel)
}
msg_puts(" ");
+ char_u *tbuf = IObuff;
+ size_t tbuflen = IOSIZE;
+ size_t len = STRLEN(qfp->qf_text) + 3;
+
+ if (len > IOSIZE) {
+ tbuf = xmalloc(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 ^^^^. */
+ // with ^^^^.
qf_fmt_text((fname != NULL || qfp->qf_lnum != 0)
? skipwhite(qfp->qf_text) : qfp->qf_text,
- (char *)IObuff, IOSIZE);
- msg_prt_line(IObuff, false);
+ (char *)tbuf, (int)tbuflen);
+ msg_prt_line(tbuf, false);
+
+ if (tbuf != IObuff) {
+ xfree(tbuf);
+ }
+
ui_flush(); // show one line at a time
}