Skip to content

Commit 9b45794

Browse files
committed
patch 8.0.0026
Problem: Error format with %W, %C and %Z does not work. (Gerd Wachsmuth) Solution: Skip code when qf_multiignore is set. (Lcd)
1 parent 936c48f commit 9b45794

File tree

3 files changed

+58
-30
lines changed

3 files changed

+58
-30
lines changed

src/quickfix.c

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,39 +1010,42 @@ qf_parse_line(
10101010
}
10111011
else if (vim_strchr((char_u *)"CZ", idx) != NULL)
10121012
{ /* continuation of multi-line msg */
1013-
qfline_T *qfprev = qi->qf_lists[qi->qf_curlist].qf_last;
1014-
1015-
if (qfprev == NULL)
1016-
return QF_FAIL;
1017-
if (*fields->errmsg && !qi->qf_multiignore)
1013+
if (!qi->qf_multiignore)
10181014
{
1019-
len = (int)STRLEN(qfprev->qf_text);
1020-
if ((ptr = alloc((unsigned)(len + STRLEN(fields->errmsg) + 2)))
1021-
== NULL)
1015+
qfline_T *qfprev = qi->qf_lists[qi->qf_curlist].qf_last;
1016+
1017+
if (qfprev == NULL)
10221018
return QF_FAIL;
1023-
STRCPY(ptr, qfprev->qf_text);
1024-
vim_free(qfprev->qf_text);
1025-
qfprev->qf_text = ptr;
1026-
*(ptr += len) = '\n';
1027-
STRCPY(++ptr, fields->errmsg);
1019+
if (*fields->errmsg && !qi->qf_multiignore)
1020+
{
1021+
len = (int)STRLEN(qfprev->qf_text);
1022+
if ((ptr = alloc((unsigned)(len + STRLEN(fields->errmsg) + 2)))
1023+
== NULL)
1024+
return QF_FAIL;
1025+
STRCPY(ptr, qfprev->qf_text);
1026+
vim_free(qfprev->qf_text);
1027+
qfprev->qf_text = ptr;
1028+
*(ptr += len) = '\n';
1029+
STRCPY(++ptr, fields->errmsg);
1030+
}
1031+
if (qfprev->qf_nr == -1)
1032+
qfprev->qf_nr = fields->enr;
1033+
if (vim_isprintc(fields->type) && !qfprev->qf_type)
1034+
/* only printable chars allowed */
1035+
qfprev->qf_type = fields->type;
1036+
1037+
if (!qfprev->qf_lnum)
1038+
qfprev->qf_lnum = fields->lnum;
1039+
if (!qfprev->qf_col)
1040+
qfprev->qf_col = fields->col;
1041+
qfprev->qf_viscol = fields->use_viscol;
1042+
if (!qfprev->qf_fnum)
1043+
qfprev->qf_fnum = qf_get_fnum(qi, qi->qf_directory,
1044+
*fields->namebuf || qi->qf_directory != NULL
1045+
? fields->namebuf
1046+
: qi->qf_currfile != NULL && fields->valid
1047+
? qi->qf_currfile : 0);
10281048
}
1029-
if (qfprev->qf_nr == -1)
1030-
qfprev->qf_nr = fields->enr;
1031-
if (vim_isprintc(fields->type) && !qfprev->qf_type)
1032-
/* only printable chars allowed */
1033-
qfprev->qf_type = fields->type;
1034-
1035-
if (!qfprev->qf_lnum)
1036-
qfprev->qf_lnum = fields->lnum;
1037-
if (!qfprev->qf_col)
1038-
qfprev->qf_col = fields->col;
1039-
qfprev->qf_viscol = fields->use_viscol;
1040-
if (!qfprev->qf_fnum)
1041-
qfprev->qf_fnum = qf_get_fnum(qi, qi->qf_directory,
1042-
*fields->namebuf || qi->qf_directory != NULL
1043-
? fields->namebuf
1044-
: qi->qf_currfile != NULL && fields->valid
1045-
? qi->qf_currfile : 0);
10461049
if (idx == 'Z')
10471050
qi->qf_multiline = qi->qf_multiignore = FALSE;
10481051
line_breakcheck();

src/testdir/test_quickfix.vim

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,29 @@ function! Test_efm_dirstack()
818818
call delete('habits1.txt')
819819
endfunction
820820

821+
" Test for resync after continuing an ignored message
822+
function! Xefm_ignore_continuations(cchar)
823+
call s:setup_commands(a:cchar)
824+
825+
let save_efm = &efm
826+
827+
let &efm =
828+
\ '%Eerror %m %l,' .
829+
\ '%-Wignored %m %l,' .
830+
\ '%+Cmore ignored %m %l,' .
831+
\ '%Zignored end'
832+
Xgetexpr ['ignored warning 1', 'more ignored continuation 2', 'ignored end', 'error resync 4']
833+
let l = map(g:Xgetlist(), '[v:val.text, v:val.valid, v:val.lnum, v:val.type]')
834+
call assert_equal([['resync', 1, 4, 'E']], l)
835+
836+
let &efm = save_efm
837+
endfunction
838+
839+
function! Test_efm_ignore_continuations()
840+
call Xefm_ignore_continuations('c')
841+
call Xefm_ignore_continuations('l')
842+
endfunction
843+
821844
" Tests for invalid error format specifies
822845
function Xinvalid_efm_Tests(cchar)
823846
call s:setup_commands(a:cchar)

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
26,
767769
/**/
768770
25,
769771
/**/

0 commit comments

Comments
 (0)