To: vim_dev@googlegroups.com Subject: Patch 8.0.0201 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0201 Problem: When completing a group name for a highlight or syntax command cleared groups are included. Solution: Skip groups that have been cleared. Files: src/syntax.c, src/testdir/test_syntax.vim *** ../vim-8.0.0200/src/syntax.c 2017-01-17 16:27:01.617153072 +0100 --- src/syntax.c 2017-01-17 17:33:43.291038448 +0100 *************** *** 22,27 **** --- 22,28 ---- { char_u *sg_name; /* highlight group name */ char_u *sg_name_u; /* uppercase of sg_name */ + int sg_cleared; /* "hi clear" was used */ /* for normal terminals */ int sg_term; /* "term=" highlighting attributes */ char_u *sg_start; /* terminal string for start highl */ *************** *** 7327,7332 **** --- 7328,7334 ---- #ifdef FEAT_EVAL HL_TABLE()[from_id - 1].sg_scriptID = current_SID; #endif + HL_TABLE()[from_id - 1].sg_cleared = FALSE; redraw_all_later(SOME_VALID); } } *************** *** 8034,8039 **** --- 8036,8042 ---- error = TRUE; break; } + HL_TABLE()[idx].sg_cleared = FALSE; /* * When highlighting has been given for a group, don't link it. *************** *** 8171,8176 **** --- 8174,8181 ---- static void highlight_clear(int idx) { + HL_TABLE()[idx].sg_cleared = TRUE; + HL_TABLE()[idx].sg_term = 0; vim_free(HL_TABLE()[idx].sg_start); HL_TABLE()[idx].sg_start = NULL; *************** *** 9958,9964 **** && include_link != 0) return (char_u *)"clear"; #endif ! if (idx < 0 || idx >= highlight_ga.ga_len) return NULL; return HL_TABLE()[idx].sg_name; } --- 9963,9975 ---- && include_link != 0) return (char_u *)"clear"; #endif ! if (idx < 0) ! return NULL; ! /* Items are never removed from the table, skip the ones that were cleared. ! */ ! while (idx < highlight_ga.ga_len && HL_TABLE()[idx].sg_cleared) ! ++idx; ! if (idx >= highlight_ga.ga_len) return NULL; return HL_TABLE()[idx].sg_name; } *** ../vim-8.0.0200/src/testdir/test_syntax.vim 2017-01-17 17:18:54.612835531 +0100 --- src/testdir/test_syntax.vim 2017-01-17 17:40:09.164519974 +0100 *************** *** 156,161 **** --- 156,167 ---- call feedkeys(":syn sync \\\"\", 'tx') call assert_equal('"syn sync ccomment clear fromstart linebreaks= linecont lines= match maxlines= minlines= region', @:) + " Check that clearing "Aap" avoids it showing up before Boolean. + hi Aap ctermfg=blue + call feedkeys(":syn list \\\"\", 'tx') + call assert_match('^"syn list Aap Boolean Character ', @:) + hi clear Aap + call feedkeys(":syn list \\\"\", 'tx') call assert_match('^"syn list Boolean Character ', @:) *************** *** 192,202 **** call assert_match('conceal off', execute('syntax conceal')) endif ! syntax region Tar start=// if 0 syntax region NotTest start=// contains=@Spell endif ! call assert_match('Tar', execute('syntax')) call assert_notmatch('NotTest', execute('syntax')) call assert_notmatch('Spell', execute('syntax')) --- 198,208 ---- call assert_match('conceal off', execute('syntax conceal')) endif ! syntax region Bar start=// if 0 syntax region NotTest start=// contains=@Spell endif ! call assert_match('Bar', execute('syntax')) call assert_notmatch('NotTest', execute('syntax')) call assert_notmatch('Spell', execute('syntax')) *************** *** 206,211 **** --- 212,219 ---- syntax rest endif call assert_equal(a, execute('hi Foo')) + hi clear Bar + hi clear Foo set ft=tags syn off *************** *** 298,304 **** func Test_invalid_arg() call assert_fails('syntax case asdf', 'E390:') ! call assert_fails('syntax conceal asdf', 'E390:') call assert_fails('syntax spell asdf', 'E390:') endfunc --- 306,314 ---- func Test_invalid_arg() call assert_fails('syntax case asdf', 'E390:') ! if has('conceal') ! call assert_fails('syntax conceal asdf', 'E390:') ! endif call assert_fails('syntax spell asdf', 'E390:') endfunc *************** *** 313,325 **** func Test_syn_clear() syntax keyword Foo foo ! syntax keyword Tar tar call assert_match('Foo', execute('syntax')) ! call assert_match('Tar', execute('syntax')) syn clear Foo call assert_notmatch('Foo', execute('syntax')) ! call assert_match('Tar', execute('syntax')) ! syn clear Foo Tar call assert_notmatch('Foo', execute('syntax')) ! call assert_notmatch('Tar', execute('syntax')) endfunc --- 323,337 ---- func Test_syn_clear() syntax keyword Foo foo ! syntax keyword Bar tar call assert_match('Foo', execute('syntax')) ! call assert_match('Bar', execute('syntax')) syn clear Foo call assert_notmatch('Foo', execute('syntax')) ! call assert_match('Bar', execute('syntax')) ! syn clear Foo Bar call assert_notmatch('Foo', execute('syntax')) ! call assert_notmatch('Bar', execute('syntax')) ! hi clear Foo ! hi clear Bar endfunc *** ../vim-8.0.0200/src/version.c 2017-01-17 17:18:54.612835531 +0100 --- src/version.c 2017-01-17 17:43:42.819123273 +0100 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 201, /**/ -- GALAHAD turns back. We see from his POV the lovely ZOOT standing by him smiling enchantingly and a number of equally delectable GIRLIES draped around in the seductively poulticed room. They look at him smilingly and wave. "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 ///