*fields->namebuf = NUL;
if (tail && *tail)
{
- STRMOVE(IObuff, skipwhite(tail));
qfl->qf_multiscan = TRUE;
return QF_MULTISCAN;
}
{ // global file names
status = qf_parse_file_pfx(idx, fields, qfl, tail);
if (status == QF_MULTISCAN)
+ {
+ char_u *s = skipwhite(tail);
+ int new_linelen = (int)STRLEN(s);
+ if (new_linelen >= linelen)
+ return QF_IGNORE_LINE;
+ linebuf = s;
+ linelen = new_linelen;
goto restofline;
+ }
}
if (fmt_ptr->flags == '-') // generally exclude this line
{
call assert_equal(['okay'], readfile("XDONE"))
endfunc
+func Test_efm_overlongline()
+ let save_efm = &efm
+ " %r captures the tail.
+ set efm=%+O(%.%#)%r,%f:%l:%m
+
+ " First line is longer than IOSIZE (1025) so the parser puts it in
+ " growbuf; the %r tail then far exceeds IObuff.
+ let lines = ['(short)' .. repeat('x', 4000), 'Xfile:10:msg']
+ call writefile(lines, 'Xqferrlong', 'D')
+
+ " Must complete without hanging or crashing.
+ cgetfile Xqferrlong
+
+ " The well-formed line that follows is still parsed.
+ let well_formed = filter(getqflist(), 'v:val.lnum == 10')
+ call assert_equal(1, len(well_formed))
+ call assert_equal('msg', well_formed[0].text)
+
+ let &efm = save_efm
+ call setqflist([], 'f')
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab