To: vim_dev@googlegroups.com Subject: Patch 8.2.0917 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0917 Problem: Quickfix entries do not suport a "note" type. Solution: Add support for "note". (partly by Yegappan Lakshmanan, closes #5527, closes #6216) Files: runtime/doc/quickfix.txt, src/quickfix.c, src/testdir/test_quickfix.vim *** ../vim-8.2.0916/runtime/doc/quickfix.txt 2020-05-31 23:11:02.082515688 +0200 --- runtime/doc/quickfix.txt 2020-06-07 14:04:39.881280911 +0200 *************** *** 1376,1382 **** %v virtual column number (finds a number representing screen column of the error (1 == 8 screen columns)) ! %t error type (finds a single character) %n error number (finds a number) %m error message (finds a string) %r matches the "rest" of a single-line file message %O/P/Q --- 1375,1385 ---- %v virtual column number (finds a number representing screen column of the error (1 == 8 screen columns)) ! %t error type (finds a single character): ! e - error message ! w - warning message ! i - info message ! n - note message %n error number (finds a number) %m error message (finds a string) %r matches the "rest" of a single-line file message %O/P/Q *************** *** 1447,1452 **** --- 1450,1456 ---- %E start of a multi-line error message %W start of a multi-line warning message %I start of a multi-line informational message + %N start of a multi-line note message %A start of a multi-line message (unspecified type) %> for next line start with current pattern again |efm-%>| %C continuation of a multi-line message *** ../vim-8.2.0916/src/quickfix.c 2020-05-31 23:11:02.082515688 +0200 --- src/quickfix.c 2020-06-07 14:04:39.881280911 +0200 *************** *** 133,138 **** --- 133,139 ---- // 'E' error message // 'W' warning message // 'I' informational message + // 'N' note message // 'C' continuation line // 'Z' end of multi-line message // 'G' general, unspecific message *************** *** 371,377 **** { if (vim_strchr((char_u *)"+-", *efmp) != NULL) efminfo->flags = *efmp++; ! if (vim_strchr((char_u *)"DXAEWICZGOPQ", *efmp) != NULL) efminfo->prefix = *efmp; else { --- 372,378 ---- { if (vim_strchr((char_u *)"+-", *efmp) != NULL) efminfo->flags = *efmp++; ! if (vim_strchr((char_u *)"DXAEWINCZGOPQ", *efmp) != NULL) efminfo->prefix = *efmp; else { *************** *** 1166,1172 **** if ((idx == 'C' || idx == 'Z') && !qf_multiline) return QF_FAIL; ! if (vim_strchr((char_u *)"EWI", idx) != NULL) fields->type = idx; else fields->type = 0; --- 1167,1173 ---- if ((idx == 'C' || idx == 'Z') && !qf_multiline) return QF_FAIL; ! if (vim_strchr((char_u *)"EWIN", idx) != NULL) fields->type = idx; else fields->type = 0; *************** *** 1439,1445 **** if (fmt_ptr->conthere) fmt_start = fmt_ptr; ! if (vim_strchr((char_u *)"AEWI", idx) != NULL) { qfl->qf_multiline = TRUE; // start of a multi-line message qfl->qf_multiignore = FALSE;// reset continuation --- 1440,1446 ---- if (fmt_ptr->conthere) fmt_start = fmt_ptr; ! if (vim_strchr((char_u *)"AEWIN", idx) != NULL) { qfl->qf_multiline = TRUE; // start of a multi-line message qfl->qf_multiignore = FALSE;// reset continuation *************** *** 3880,3890 **** --- 3881,3893 ---- * e or E 0 " error" * w or W 0 " warning" * i or I 0 " info" + * n or N 0 " note" * 0 0 "" * other 0 " c" * e or E n " error n" * w or W n " warning n" * i or I n " info n" + * n or N n " note n" * 0 n " error n" * other n " c n" * 1 x "" :helpgrep *************** *** 3900,3905 **** --- 3903,3910 ---- p = (char_u *)" warning"; else if (c == 'I' || c == 'i') p = (char_u *)" info"; + else if (c == 'N' || c == 'n') + p = (char_u *)" note"; else if (c == 'E' || c == 'e' || (c == 0 && nr > 0)) p = (char_u *)" error"; else if (c == 0 || c == 1) *** ../vim-8.2.0916/src/testdir/test_quickfix.vim 2020-05-31 23:11:02.086515671 +0200 --- src/testdir/test_quickfix.vim 2020-06-07 14:04:39.889280964 +0200 *************** *** 1347,1352 **** --- 1347,1382 ---- let &efm = save_efm endfunc + " Test for '%t' (error type) field in 'efm' + func Test_efm_error_type() + let save_efm = &efm + + " error type + set efm=%f:%l:%t:%m + cexpr ["Xfile1:10:E:msg1", "Xfile1:20:W:msg2", "Xfile1:30:I:msg3", + \ "Xfile1:40:N:msg4", "Xfile1:50:R:msg5"] + let output = split(execute('clist'), "\n") + call assert_equal([ + \ ' 1 Xfile1:10 error: msg1', + \ ' 2 Xfile1:20 warning: msg2', + \ ' 3 Xfile1:30 info: msg3', + \ ' 4 Xfile1:40 note: msg4', + \ ' 5 Xfile1:50 R: msg5'], output) + + " error type and a error number + set efm=%f:%l:%t:%n:%m + cexpr ["Xfile1:10:E:2:msg1", "Xfile1:20:W:4:msg2", "Xfile1:30:I:6:msg3", + \ "Xfile1:40:N:8:msg4", "Xfile1:50:R:3:msg5"] + let output = split(execute('clist'), "\n") + call assert_equal([ + \ ' 1 Xfile1:10 error 2: msg1', + \ ' 2 Xfile1:20 warning 4: msg2', + \ ' 3 Xfile1:30 info 6: msg3', + \ ' 4 Xfile1:40 note 8: msg4', + \ ' 5 Xfile1:50 R 3: msg5'], output) + let &efm = save_efm + endfunc + func XquickfixChangedByAutocmd(cchar) call s:setup_commands(a:cchar) if a:cchar == 'c' *** ../vim-8.2.0916/src/version.c 2020-06-06 22:36:20.464116743 +0200 --- src/version.c 2020-06-07 14:10:00.447824382 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 917, /**/ -- GALAHAD: No look, really, this isn't nescess ... PIGLET: We must examine you. GALAHAD: There's nothing wrong with ... that. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///