From 8594b0858fd2d8e629b58ce323d77fdb891547d9 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 28 Nov 2023 23:35:40 +0100 Subject: vim-patch:a9058440b7b9 runtime(html): Update syntax file (vim/vim#13591) Add missing search element and update ARIA attribute list. Add a very basic test file to check all elements are matched. https://github.com/vim/vim/commit/a9058440b7b9d7f5d0027c8cd44366e9200ca241 Co-authored-by: dkearns --- runtime/syntax/html.vim | 90 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 71 insertions(+), 19 deletions(-) diff --git a/runtime/syntax/html.vim b/runtime/syntax/html.vim index 82c829a2e1..c975ae8620 100644 --- a/runtime/syntax/html.vim +++ b/runtime/syntax/html.vim @@ -3,9 +3,9 @@ " Maintainer: Doug Kearns " Previous Maintainers: Jorge Maldonado Ventura " Claudio Fleiner -" Last Change: 2023 Feb 20 +" Last Change: 2023 Nov 28 -" Please check :help html.vim for some comments and a description of the options +" See :help html.vim for some comments and a description of the options " quit when a syntax file was already loaded if !exists("main_syntax") @@ -28,7 +28,6 @@ syn case ignore " mark illegal characters syn match htmlError "[<>&]" - " tags syn region htmlString contained start=+"+ end=+"+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc syn region htmlString contained start=+'+ end=+'+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc @@ -39,7 +38,6 @@ syn match htmlTagN contained +<\s*[-a-zA-Z0-9]\++hs=s+1 contains=htmlTagName, syn match htmlTagN contained +]<"ms=s+1 - " tag names syn keyword htmlTagName contained address applet area a base basefont syn keyword htmlTagName contained big blockquote br caption center @@ -61,7 +59,7 @@ syn keyword htmlTagName contained article aside audio bdi canvas data syn keyword htmlTagName contained datalist details dialog embed figcaption syn keyword htmlTagName contained figure footer header hgroup keygen main syn keyword htmlTagName contained mark menuitem meter nav output picture -syn keyword htmlTagName contained progress rb rp rt rtc ruby section +syn keyword htmlTagName contained progress rb rp rt rtc ruby search section syn keyword htmlTagName contained slot source summary template time track syn keyword htmlTagName contained video wbr @@ -88,19 +86,72 @@ syn keyword htmlArg contained size src start target text type url syn keyword htmlArg contained usemap ismap valign value vlink vspace width wrap syn match htmlArg contained "\<\%(http-equiv\|href\|title\)="me=e-1 -" aria attributes -exe 'syn match htmlArg contained "\"' syn keyword htmlArg contained role +" ARIA attributes {{{1 +let s:aria =<< trim END + activedescendant + atomic + autocomplete + braillelabel + brailleroledescription + busy + checked + colcount + colindex + colindextext + colspan + controls + current + describedby + description + details + disabled + errormessage + expanded + flowto + haspopup + hidden + invalid + keyshortcuts + label + labelledby + level + live + modal + multiline + multiselectable + orientation + owns + placeholder + posinset + pressed + readonly + relevant + required + roledescription + rowcount + rowindex + rowindextext + rowspan + selected + setsize + sort + valuemax + valuemin + valuenow + valuetext +END +let s:aria_deprecated =<< trim END + dropeffect + grabbed +END + +call extend(s:aria, s:aria_deprecated) +exe 'syn match htmlArg contained "\%#=1\join('\|') .. '\)\>"' +unlet s:aria s:aria_deprecated +" }}} + " Netscape extensions syn keyword htmlTagName contained frame noframes frameset nobr blink syn keyword htmlTagName contained layer ilayer nolayer spacer @@ -321,9 +372,9 @@ if !exists("html_no_rendering") hi def htmlUnderlineItalic term=italic,underline cterm=italic,underline gui=italic,underline hi def htmlItalic term=italic cterm=italic gui=italic if v:version > 800 || v:version == 800 && has("patch1038") - hi def htmlStrike term=strikethrough cterm=strikethrough gui=strikethrough + hi def htmlStrike term=strikethrough cterm=strikethrough gui=strikethrough else - hi def htmlStrike term=underline cterm=underline gui=underline + hi def htmlStrike term=underline cterm=underline gui=underline endif endif endif @@ -356,4 +407,5 @@ endif let &cpo = s:cpo_save unlet s:cpo_save -" vim: ts=8 + +" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker: -- cgit From 73691b6c3ded0c97aea0af13abab94b7a93776b0 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 30 Nov 2023 07:06:23 +0800 Subject: test(ex_terminal_spec): unskip tests that work on Windows (#26310) --- test/functional/terminal/ex_terminal_spec.lua | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/test/functional/terminal/ex_terminal_spec.lua b/test/functional/terminal/ex_terminal_spec.lua index f628e261a2..bfb8f2136c 100644 --- a/test/functional/terminal/ex_terminal_spec.lua +++ b/test/functional/terminal/ex_terminal_spec.lua @@ -163,7 +163,6 @@ describe(':terminal (with fake shell)', function() end it('with no argument, acts like termopen()', function() - skip(is_os('win')) -- Use the EXIT subcommand to end the process with a non-zero exit code to -- prevent the buffer from closing automatically nvim('set_option_value', 'shellcmdflag', 'EXIT', {}) @@ -190,7 +189,6 @@ describe(':terminal (with fake shell)', function() end) it("with no argument, but 'shell' has arguments, acts like termopen()", function() - skip(is_os('win')) nvim('set_option_value', 'shell', testprg('shell-test')..' -t jeff', {}) terminal_with_fake_shell() screen:expect([[ @@ -202,7 +200,6 @@ describe(':terminal (with fake shell)', function() end) it('executes a given command through the shell', function() - skip(is_os('win')) command('set shellxquote=') -- win: avoid extra quotes terminal_with_fake_shell('echo hi') screen:expect([[ @@ -214,7 +211,6 @@ describe(':terminal (with fake shell)', function() end) it("executes a given command through the shell, when 'shell' has arguments", function() - skip(is_os('win')) nvim('set_option_value', 'shell', testprg('shell-test')..' -t jeff', {}) command('set shellxquote=') -- win: avoid extra quotes terminal_with_fake_shell('echo hi') @@ -227,7 +223,6 @@ describe(':terminal (with fake shell)', function() end) it('allows quotes and slashes', function() - skip(is_os('win')) command('set shellxquote=') -- win: avoid extra quotes terminal_with_fake_shell([[echo 'hello' \ "world"]]) screen:expect([[ @@ -247,14 +242,14 @@ describe(':terminal (with fake shell)', function() end) it('ignores writes if the backing stream closes', function() - terminal_with_fake_shell() - feed('iiXXXXXXX') - poke_eventloop() - -- Race: Though the shell exited (and streams were closed by SIGCHLD - -- handler), :terminal cleanup is pending on the main-loop. - -- This write should be ignored (not crash, #5445). - feed('iiYYYYYYY') - assert_alive() + terminal_with_fake_shell() + feed('iiXXXXXXX') + poke_eventloop() + -- Race: Though the shell exited (and streams were closed by SIGCHLD + -- handler), :terminal cleanup is pending on the main-loop. + -- This write should be ignored (not crash, #5445). + feed('iiYYYYYYY') + assert_alive() end) it('works with findfile()', function() @@ -264,7 +259,6 @@ describe(':terminal (with fake shell)', function() end) it('works with :find', function() - skip(is_os('win')) nvim('set_option_value', 'shellcmdflag', 'EXIT', {}) terminal_with_fake_shell(1) screen:expect([[ @@ -284,7 +278,6 @@ describe(':terminal (with fake shell)', function() end) it('works with gf', function() - skip(is_os('win')) command('set shellxquote=') -- win: avoid extra quotes terminal_with_fake_shell([[echo "scripts/shadacat.py"]]) retry(nil, 4 * screen.timeout, function() -- cgit From 65de1a22c4d94cd8591f90255bcde72e6b385e60 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 30 Nov 2023 07:31:22 +0800 Subject: ci(lintcommit): fix empty and period check with multiple colons (#26312) --- scripts/lintcommit.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/lintcommit.lua b/scripts/lintcommit.lua index d2c8601c25..a3ad4657e9 100644 --- a/scripts/lintcommit.lua +++ b/scripts/lintcommit.lua @@ -74,7 +74,11 @@ local function validate_commit(commit_message) if after_idx > vim.tbl_count(commit_split) then return [[Commit message does not include colons.]] end - local after_colon = commit_split[after_idx] + local after_colon = '' + while after_idx <= vim.tbl_count(commit_split) do + after_colon = after_colon .. commit_split[after_idx] + after_idx = after_idx + 1 + end -- Check if commit introduces a breaking change. if vim.endswith(before_colon, "!") then @@ -239,11 +243,14 @@ function M._test() ['refactor(): empty scope'] = false, ['ci( ): whitespace as scope'] = false, ['ci: period at end of sentence.'] = false, + ['ci: period: at end of sentence.'] = false, ['ci: Capitalized first word'] = false, ['ci: UPPER_CASE First Word'] = true, ['unknown: using unknown type'] = false, ['feat: foo:bar'] = true, + ['feat: :foo:bar'] = true, ['feat(something): foo:bar'] = true, + ['feat(something): :foo:bar'] = true, ['feat(:grep): read from pipe'] = true, ['feat(:grep/:make): read from pipe'] = true, ['feat(:grep): foo:bar'] = true, -- cgit From 5ca6c9e04629fee4e9f1f9786e9d36a2f892160c Mon Sep 17 00:00:00 2001 From: Luki446 Date: Sat, 11 Nov 2023 22:32:08 +0100 Subject: fix(terminal): make backslashes in 'shell' work on Windows If backslashes are used in 'shell' option, escape them to make Terminal mode work. --- src/nvim/ex_docmd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 0b466bbe4e..245121f4af 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -7424,7 +7424,9 @@ static void ex_terminal(exarg_T *eap) char shell_argv[512] = { 0 }; while (*p != NULL) { - snprintf(tempstring, sizeof(tempstring), ",\"%s\"", *p); + char *escaped = vim_strsave_escaped(*p, "\"\\"); + snprintf(tempstring, sizeof(tempstring), ",\"%s\"", escaped); + xfree(escaped); xstrlcat(shell_argv, tempstring, sizeof(shell_argv)); p++; } -- cgit From 90b213990f02d2a86019ef4058ad86a995931bea Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 30 Nov 2023 07:15:34 +0800 Subject: test: :terminal when 'shell' uses backslashes --- test/functional/terminal/ex_terminal_spec.lua | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/test/functional/terminal/ex_terminal_spec.lua b/test/functional/terminal/ex_terminal_spec.lua index bfb8f2136c..bf0aade255 100644 --- a/test/functional/terminal/ex_terminal_spec.lua +++ b/test/functional/terminal/ex_terminal_spec.lua @@ -141,15 +141,20 @@ describe(':terminal', function() end) end) -describe(':terminal (with fake shell)', function() +local function test_terminal_with_fake_shell(backslash) + -- shell-test.c is a fake shell that prints its arguments and exits. + local shell_path = testprg('shell-test') + if backslash then + shell_path = shell_path:gsub('/', [[\]]) + end + local screen before_each(function() clear() screen = Screen.new(50, 4) screen:attach({rgb=false}) - -- shell-test.c is a fake shell that prints its arguments and exits. - nvim('set_option_value', 'shell', testprg('shell-test'), {}) + nvim('set_option_value', 'shell', shell_path, {}) nvim('set_option_value', 'shellcmdflag', 'EXE', {}) nvim('set_option_value', 'shellxquote', '', {}) end) @@ -189,7 +194,7 @@ describe(':terminal (with fake shell)', function() end) it("with no argument, but 'shell' has arguments, acts like termopen()", function() - nvim('set_option_value', 'shell', testprg('shell-test')..' -t jeff', {}) + nvim('set_option_value', 'shell', shell_path ..' -t jeff', {}) terminal_with_fake_shell() screen:expect([[ ^jeff $ | @@ -211,7 +216,7 @@ describe(':terminal (with fake shell)', function() end) it("executes a given command through the shell, when 'shell' has arguments", function() - nvim('set_option_value', 'shell', testprg('shell-test')..' -t jeff', {}) + nvim('set_option_value', 'shell', shell_path ..' -t jeff', {}) command('set shellxquote=') -- win: avoid extra quotes terminal_with_fake_shell('echo hi') screen:expect([[ @@ -304,4 +309,13 @@ describe(':terminal (with fake shell)', function() terminal]]) end end) +end + +describe(':terminal (with fake shell)', function() + test_terminal_with_fake_shell(false) + if is_os('win') then + describe("when 'shell' uses backslashes", function() + test_terminal_with_fake_shell(true) + end) + end end) -- cgit From 62dff439479315558cd08dedbca61be5fafcc938 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 30 Nov 2023 08:56:21 +0800 Subject: test(ex_terminal_spec): match descriptions (#26314) --- test/functional/terminal/ex_terminal_spec.lua | 52 ++++++++++++--------------- 1 file changed, 22 insertions(+), 30 deletions(-) diff --git a/test/functional/terminal/ex_terminal_spec.lua b/test/functional/terminal/ex_terminal_spec.lua index bf0aade255..77fe57dd94 100644 --- a/test/functional/terminal/ex_terminal_spec.lua +++ b/test/functional/terminal/ex_terminal_spec.lua @@ -159,32 +159,22 @@ local function test_terminal_with_fake_shell(backslash) nvim('set_option_value', 'shellxquote', '', {}) end) - -- Invokes `:terminal {cmd}` using a fake shell (shell-test.c) which prints - -- the {cmd} and exits immediately. - -- When no argument is given and the exit code is zero, the terminal buffer - -- closes automatically. - local function terminal_with_fake_shell(cmd) - feed_command("terminal "..(cmd and cmd or "")) - end - it('with no argument, acts like termopen()', function() - -- Use the EXIT subcommand to end the process with a non-zero exit code to - -- prevent the buffer from closing automatically - nvim('set_option_value', 'shellcmdflag', 'EXIT', {}) - terminal_with_fake_shell(1) + command('autocmd! nvim_terminal TermClose') + feed_command('terminal') retry(nil, 4 * screen.timeout, function() screen:expect([[ - ^ | - [Process exited 1] | + ^ready $ | + [Process exited 0] | | - :terminal 1 | + :terminal | ]]) end) end) it("with no argument, and 'shell' is set to empty string", function() nvim('set_option_value', 'shell', '', {}) - terminal_with_fake_shell() + feed_command('terminal') screen:expect([[ ^ | ~ | @@ -194,11 +184,11 @@ local function test_terminal_with_fake_shell(backslash) end) it("with no argument, but 'shell' has arguments, acts like termopen()", function() - nvim('set_option_value', 'shell', shell_path ..' -t jeff', {}) - terminal_with_fake_shell() + nvim('set_option_value', 'shell', shell_path ..' INTERACT', {}) + feed_command('terminal') screen:expect([[ - ^jeff $ | - [Process exited 0] | + ^interact $ | + | | :terminal | ]]) @@ -206,7 +196,7 @@ local function test_terminal_with_fake_shell(backslash) it('executes a given command through the shell', function() command('set shellxquote=') -- win: avoid extra quotes - terminal_with_fake_shell('echo hi') + feed_command('terminal echo hi') screen:expect([[ ^ready $ echo hi | | @@ -218,7 +208,7 @@ local function test_terminal_with_fake_shell(backslash) it("executes a given command through the shell, when 'shell' has arguments", function() nvim('set_option_value', 'shell', shell_path ..' -t jeff', {}) command('set shellxquote=') -- win: avoid extra quotes - terminal_with_fake_shell('echo hi') + feed_command('terminal echo hi') screen:expect([[ ^jeff $ echo hi | | @@ -229,7 +219,7 @@ local function test_terminal_with_fake_shell(backslash) it('allows quotes and slashes', function() command('set shellxquote=') -- win: avoid extra quotes - terminal_with_fake_shell([[echo 'hello' \ "world"]]) + feed_command([[terminal echo 'hello' \ "world"]]) screen:expect([[ ^ready $ echo 'hello' \ "world" | | @@ -247,7 +237,8 @@ local function test_terminal_with_fake_shell(backslash) end) it('ignores writes if the backing stream closes', function() - terminal_with_fake_shell() + command('autocmd! nvim_terminal TermClose') + feed_command('terminal') feed('iiXXXXXXX') poke_eventloop() -- Race: Though the shell exited (and streams were closed by SIGCHLD @@ -258,19 +249,20 @@ local function test_terminal_with_fake_shell(backslash) end) it('works with findfile()', function() + command('autocmd! nvim_terminal TermClose') feed_command('terminal') eq('term://', string.match(eval('bufname("%")'), "^term://")) eq('scripts/shadacat.py', eval('findfile("scripts/shadacat.py", ".")')) end) it('works with :find', function() - nvim('set_option_value', 'shellcmdflag', 'EXIT', {}) - terminal_with_fake_shell(1) + command('autocmd! nvim_terminal TermClose') + feed_command('terminal') screen:expect([[ - ^ | - [Process exited 1] | + ^ready $ | + [Process exited 0] | | - :terminal 1 | + :terminal | ]]) eq('term://', string.match(eval('bufname("%")'), "^term://")) feed([[]]) @@ -284,7 +276,7 @@ local function test_terminal_with_fake_shell(backslash) it('works with gf', function() command('set shellxquote=') -- win: avoid extra quotes - terminal_with_fake_shell([[echo "scripts/shadacat.py"]]) + feed_command([[terminal echo "scripts/shadacat.py"]]) retry(nil, 4 * screen.timeout, function() screen:expect([[ ^ready $ echo "scripts/shadacat.py" | -- cgit