From: Dmytro Meleshko Date: Wed, 24 Jun 2026 17:51:22 +0000 (+0000) Subject: patch 9.2.0718: :syn sync without an argument also lists syntax cluster X-Git-Tag: v9.2.0718^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2954c821ebf007503bc29cd25d01974f691432c;p=thirdparty%2Fvim.git patch 9.2.0718: :syn sync without an argument also lists syntax cluster Problem: :syn sync without an argument also lists every defined cluster Solution: Fix control flow in syn_cmd_list() so that only the syncing items are printed when this function gets called by :syn sync. (dmitmel) closes: #20614 Signed-off-by: Dmytro Meleshko Signed-off-by: Christian Brabandt --- diff --git a/src/po/vim.pot b/src/po/vim.pot index bbbf9f0cc2..131e52457f 100644 --- a/src/po/vim.pot +++ b/src/po/vim.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Vim\n" "Report-Msgid-Bugs-To: vim-dev@vim.org\n" -"POT-Creation-Date: 2026-06-22 19:36+0000\n" +"POT-Creation-Date: 2026-06-24 17:52+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -3109,26 +3109,26 @@ msgstr "" msgid "syncing on C-style comments" msgstr "" -msgid "no syncing" +msgid "" +"\n" +"--- Syntax sync items ---" msgstr "" -msgid "syncing starts at the first line" +msgid "" +"\n" +"syncing on items" msgstr "" -msgid "syncing starts " +msgid "no syncing" msgstr "" -msgid " lines before top line" +msgid "syncing starts at the first line" msgstr "" -msgid "" -"\n" -"--- Syntax sync items ---" +msgid "syncing starts " msgstr "" -msgid "" -"\n" -"syncing on items" +msgid " lines before top line" msgstr "" msgid "" diff --git a/src/syntax.c b/src/syntax.c index 4333c31839..6f22d9ece6 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -3834,9 +3834,22 @@ syn_cmd_list( msg_puts(_("syncing on C-style comments")); syn_lines_msg(); syn_match_msg(); - return; } - else if (!(curwin->w_s->b_syn_sync_flags & SF_MATCH)) + else if (curwin->w_s->b_syn_sync_flags & SF_MATCH) + { + msg_puts_title(_("\n--- Syntax sync items ---")); + if (curwin->w_s->b_syn_sync_minlines > 0 + || curwin->w_s->b_syn_sync_maxlines > 0 + || curwin->w_s->b_syn_sync_linebreaks > 0) + { + msg_puts(_("\nsyncing on items")); + syn_lines_msg(); + syn_match_msg(); + } + for (id = 1; id <= highlight_num_groups() && !got_int; ++id) + syn_list_one(id, syncing, FALSE); + } + else { if (curwin->w_s->b_syn_sync_minlines == 0) msg_puts(_("no syncing")); @@ -3852,20 +3865,11 @@ syn_cmd_list( } syn_match_msg(); } - return; - } - msg_puts_title(_("\n--- Syntax sync items ---")); - if (curwin->w_s->b_syn_sync_minlines > 0 - || curwin->w_s->b_syn_sync_maxlines > 0 - || curwin->w_s->b_syn_sync_linebreaks > 0) - { - msg_puts(_("\nsyncing on items")); - syn_lines_msg(); - syn_match_msg(); } + return; } - else - msg_puts_title(_("\n--- Syntax items ---")); + + msg_puts_title(_("\n--- Syntax items ---")); if (ends_excmd2(eap->cmd, arg)) { /* diff --git a/src/testdir/test_syntax.vim b/src/testdir/test_syntax.vim index 170e2e3b93..d4a81dd656 100644 --- a/src/testdir/test_syntax.vim +++ b/src/testdir/test_syntax.vim @@ -419,6 +419,25 @@ func Test_syn_sync() call assert_match('SyncHere', execute('syntax sync')) syn sync clear call assert_notmatch('SyncHere', execute('syntax sync')) + + syn sync minlines=10 + syntax cluster xmlStuff contains=xmlGroup1,xmlGroup2 + syntax region xmlComment start=// keepend contains=@Spell + syntax sync match xmlSync1 grouphere xmlComment // + syntax cluster xmlAll contains=ALL + let out = execute('syntax sync') + call assert_match('xmlSync1', out) + call assert_match('xmlSync2', out) + call assert_match('grouphere xmlComment', out) + call assert_match('groupthere NONE', out) + call assert_notmatch('xmlStuff', out) + call assert_notmatch('xmlAll', out) + call assert_notmatch('cluster', out) + call assert_notmatch('keepend', out) + " should output 4 lines: 1 header + 3 syn sync lines + call assert_equal(4, len(split(out, '\n'))) + syn clear endfunc diff --git a/src/version.c b/src/version.c index 72f154f3e6..7fd7b6b801 100644 --- a/src/version.c +++ b/src/version.c @@ -759,6 +759,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 718, /**/ 717, /**/