diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2023-11-29 18:49:30 -0700 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2023-11-29 18:49:30 -0700 |
commit | e70fdd00f1cd96c364fe894af61ee5947991414e (patch) | |
tree | bde3942d3b01c891166bd02da164797b140f7055 | |
parent | 0bd3cd90d902a1419db129427980ad7af1650d50 (diff) | |
parent | 62dff439479315558cd08dedbca61be5fafcc938 (diff) | |
download | rneovim-fix_20726.tar.gz rneovim-fix_20726.tar.bz2 rneovim-fix_20726.zip |
Merge remote-tracking branch 'upstream/master' into fix_20726fix_20726
-rw-r--r-- | runtime/syntax/html.vim | 90 | ||||
-rw-r--r-- | scripts/lintcommit.lua | 9 | ||||
-rw-r--r-- | src/nvim/ex_docmd.c | 4 | ||||
-rw-r--r-- | test/functional/terminal/ex_terminal_spec.lua | 95 |
4 files changed, 129 insertions, 69 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 <dougkearns@gmail.com> " Previous Maintainers: Jorge Maldonado Ventura <jorgesumle@freakspot.net> " Claudio Fleiner <claudio@fleiner.com> -" 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 +</\s*[-a-zA-Z0-9]\++hs=s+2 contains=htmlTagName,htmlSpecialTagName,@htmlTagNameCluster syn match htmlTagError 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 "\<aria-\%(' . join([ - \ 'activedescendant', 'atomic', 'autocomplete', 'busy', 'checked', 'colcount', - \ 'colindex', 'colspan', 'controls', 'current', 'describedby', 'details', - \ 'disabled', 'dropeffect', 'errormessage', 'expanded', 'flowto', 'grabbed', - \ 'haspopup', 'hidden', 'invalid', 'keyshortcuts', 'label', 'labelledby', 'level', - \ 'live', 'modal', 'multiline', 'multiselectable', 'orientation', 'owns', - \ 'placeholder', 'posinset', 'pressed', 'readonly', 'relevant', 'required', - \ 'roledescription', 'rowcount', 'rowindex', 'rowspan', 'selected', 'setsize', - \ 'sort', 'valuemax', 'valuemin', 'valuenow', 'valuetext' - \ ], '\|') . '\)\>"' 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\<aria-\%(' .. s:aria->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: 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, 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++; } diff --git a/test/functional/terminal/ex_terminal_spec.lua b/test/functional/terminal/ex_terminal_spec.lua index f628e261a2..77fe57dd94 100644 --- a/test/functional/terminal/ex_terminal_spec.lua +++ b/test/functional/terminal/ex_terminal_spec.lua @@ -141,46 +141,40 @@ 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) - -- 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() - 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', {}) - 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([[ ^ | ~ | @@ -190,21 +184,19 @@ 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() + nvim('set_option_value', 'shell', shell_path ..' INTERACT', {}) + feed_command('terminal') screen:expect([[ - ^jeff $ | - [Process exited 0] | + ^interact $ | + | | :terminal | ]]) 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') + feed_command('terminal echo hi') screen:expect([[ ^ready $ echo hi | | @@ -214,10 +206,9 @@ 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', {}) + 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 | | @@ -227,9 +218,8 @@ 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"]]) + feed_command([[terminal echo 'hello' \ "world"]]) screen:expect([[ ^ready $ echo 'hello' \ "world" | | @@ -247,31 +237,32 @@ 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() + command('autocmd! nvim_terminal TermClose') + feed_command('terminal') + 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() + 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() - skip(is_os('win')) - 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([[<C-\><C-N>]]) @@ -284,9 +275,8 @@ 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"]]) + feed_command([[terminal echo "scripts/shadacat.py"]]) retry(nil, 4 * screen.timeout, function() screen:expect([[ ^ready $ echo "scripts/shadacat.py" | @@ -311,4 +301,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) |