Patch 9.0.1616
Problem:    Quickfix text field is truncated.
Solution:   Fix output of text field after pattern field in quickfix buffer.
            (Shane Harper, closes #12498)
Files:      src/quickfix.c, src/testdir/test_quickfix.vim


*** ../vim-9.0.1615/src/quickfix.c      2023-04-29 21:38:00.563105306 +0100
--- src/quickfix.c      2023-06-07 19:05:54.740539789 +0100
***************
*** 3340,3345 ****
--- 3340,3346 ----
      // Add the message, skipping leading whitespace and newlines.
      ga_concat(gap, IObuff);
      qf_fmt_text(gap, skipwhite(qf_ptr->qf_text));
+     ga_append(gap, NUL);
  
      // Output the message.  Overwrite to avoid scrolling when the 'O'
      // flag is present in 'shortmess'; But when not jumping, print the
***************
*** 3660,3668 ****
      if (qfp->qf_lnum != 0)
        msg_puts_attr(":", qfSepAttr);
      gap = qfga_get();
!     if (qfp->qf_lnum == 0)
!       ga_append(gap, NUL);
!     else
        qf_range_text(gap, qfp);
      ga_concat(gap, qf_types(qfp->qf_type, qfp->qf_nr));
      ga_append(gap, NUL);
--- 3661,3667 ----
      if (qfp->qf_lnum != 0)
        msg_puts_attr(":", qfSepAttr);
      gap = qfga_get();
!     if (qfp->qf_lnum != 0)
        qf_range_text(gap, qfp);
      ga_concat(gap, qf_types(qfp->qf_type, qfp->qf_nr));
      ga_append(gap, NUL);
***************
*** 3672,3677 ****
--- 3671,3677 ----
      {
        gap = qfga_get();
        qf_fmt_text(gap, qfp->qf_pattern);
+       ga_append(gap, NUL);
        msg_puts((char *)gap->ga_data);
        msg_puts_attr(":", qfSepAttr);
      }
***************
*** 3682,3688 ****
      // with ^^^^.
      gap = qfga_get();
      qf_fmt_text(gap, (fname != NULL || qfp->qf_lnum != 0)
!           ? skipwhite(qfp->qf_text) : qfp->qf_text);
      msg_prt_line((char_u *)gap->ga_data, FALSE);
      out_flush();              // show one line at a time
  }
--- 3682,3689 ----
      // with ^^^^.
      gap = qfga_get();
      qf_fmt_text(gap, (fname != NULL || qfp->qf_lnum != 0)
!                                    ? skipwhite(qfp->qf_text) : qfp->qf_text);
!     ga_append(gap, NUL);
      msg_prt_line((char_u *)gap->ga_data, FALSE);
      out_flush();              // show one line at a time
  }
***************
*** 3774,3780 ****
  qf_fmt_text(garray_T *gap, char_u *text)
  {
      char_u    *p = text;
- 
      while (*p != NUL)
      {
        if (*p == '\n')
--- 3775,3780 ----
***************
*** 3787,3794 ****
        else
            ga_append(gap, *p++);
      }
- 
-     ga_append(gap, NUL);
  }
  
  /*
--- 3787,3792 ----
***************
*** 3807,3814 ****
  
      if (qfp->qf_end_lnum > 0 && qfp->qf_lnum != qfp->qf_end_lnum)
      {
!       vim_snprintf((char *)buf + len, bufsize - len,
!               "-%ld", qfp->qf_end_lnum);
        len += (int)STRLEN(buf + len);
      }
      if (qfp->qf_col > 0)
--- 3805,3812 ----
  
      if (qfp->qf_end_lnum > 0 && qfp->qf_lnum != qfp->qf_end_lnum)
      {
!       vim_snprintf((char *)buf + len, bufsize - len, "-%ld",
!                                                            qfp->qf_end_lnum);
        len += (int)STRLEN(buf + len);
      }
      if (qfp->qf_col > 0)
***************
*** 3817,3828 ****
        len += (int)STRLEN(buf + len);
        if (qfp->qf_end_col > 0 && qfp->qf_col != qfp->qf_end_col)
        {
!           vim_snprintf((char *)buf + len, bufsize - len,
!                   "-%d", qfp->qf_end_col);
            len += (int)STRLEN(buf + len);
        }
      }
-     buf[len] = NUL;
  
      ga_concat_len(gap, buf, len);
  }
--- 3815,3825 ----
        len += (int)STRLEN(buf + len);
        if (qfp->qf_end_col > 0 && qfp->qf_col != qfp->qf_end_col)
        {
!           vim_snprintf((char *)buf + len, bufsize - len, "-%d",
!                                                             qfp->qf_end_col);
            len += (int)STRLEN(buf + len);
        }
      }
  
      ga_concat_len(gap, buf, len);
  }
***************
*** 4659,4665 ****
      if (qftf_str != NULL && *qftf_str != NUL)
      {
        ga_concat(gap, qftf_str);
-       ga_append(gap, NUL);
      }
      else
      {
--- 4656,4661 ----
***************
*** 4706,4711 ****
--- 4702,4708 ----
                                                               : qfp->qf_text);
      }
  
+     ga_append(gap, NUL);
      if (ml_append_buf(buf, lnum, gap->ga_data, gap->ga_len, FALSE) == FAIL)
        return FAIL;
  
*** ../vim-9.0.1615/src/testdir/test_quickfix.vim       2023-06-05 
21:52:41.847715785 +0100
--- src/testdir/test_quickfix.vim       2023-06-07 19:00:37.672600159 +0100
***************
*** 167,179 ****
              \ {'lnum':20,'col':10,'type':'e','text':'Error','nr':22},
              \ {'lnum':30,'col':15,'type':'i','text':'Info','nr':33},
              \ {'lnum':40,'col':20,'type':'x', 'text':'Other','nr':44},
!             \ {'lnum':50,'col':25,'type':"\<C-A>",'text':'one','nr':55}])
    let l = split(execute('Xlist', ""), "\n")
    call assert_equal([' 1:10 col 5 warning  11: Warning',
              \ ' 2:20 col 10 error  22: Error',
              \ ' 3:30 col 15 info  33: Info',
              \ ' 4:40 col 20 x  44: Other',
!             \ ' 5:50 col 25  55: one'], l)
  
    " Test for module names, one needs to explicitly set `'valid':v:true` so
    call g:Xsetlist([
--- 167,181 ----
              \ {'lnum':20,'col':10,'type':'e','text':'Error','nr':22},
              \ {'lnum':30,'col':15,'type':'i','text':'Info','nr':33},
              \ {'lnum':40,'col':20,'type':'x', 'text':'Other','nr':44},
!             \ {'lnum':50,'col':25,'type':"\<C-A>",'text':'one','nr':55},
!             \ {'lnum':0,'type':'e','text':'Check type field is output even 
when lnum==0. ("error" was not output by v9.0.0736.)','nr':66}])
    let l = split(execute('Xlist', ""), "\n")
    call assert_equal([' 1:10 col 5 warning  11: Warning',
              \ ' 2:20 col 10 error  22: Error',
              \ ' 3:30 col 15 info  33: Info',
              \ ' 4:40 col 20 x  44: Other',
!             \ ' 5:50 col 25  55: one',
!               \ ' 6 error  66: Check type field is output even when lnum==0. 
("error" was not output by v9.0.0736.)'], l)
  
    " Test for module names, one needs to explicitly set `'valid':v:true` so
    call g:Xsetlist([
***************
*** 6428,6431 ****
--- 6430,6440 ----
    bwipe!
  endfunc
  
+ func Test_quickfix_buffer_contents()
+   call setqflist([{'filename':'filename', 'pattern':'pattern', 
'text':'text'}])
+   copen
+   call assert_equal(['filename|pattern| text'], getline(1, '$'))  " The 
assert failed with Vim v9.0.0736; '| text' did not appear after the pattern.
+   call setqflist([], 'f')
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-9.0.1615/src/version.c       2023-06-07 18:26:58.025112415 +0100
--- src/version.c       2023-06-07 19:08:58.832508449 +0100
***************
*** 697,698 ****
--- 697,700 ----
  {   /* Add new patch number below this line */
+ /**/
+     1616,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
129. You cancel your newspaper subscription.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20230607181042.B4AC01C0642%40moolenaar.net.

Raspunde prin e-mail lui