From ad34abee258322826146d597ac5b5fd2111c2b79 Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Mon, 7 Aug 2023 03:21:48 +0900 Subject: [PATCH 001/163] patch 9.0.1678: blade files are not recognized Problem: Blade files are not recognized. Solution: Add a pattern for Blade files. (closes #12650) Co-authored-by: Bram Moolenaar --- runtime/filetype.vim | 3 +++ src/testdir/test_filetype.vim | 1 + src/version.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/runtime/filetype.vim b/runtime/filetype.vim index cdeb556410..d0ee535f58 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -254,6 +254,9 @@ au BufNewFile,BufRead named*.conf,rndc*.conf,rndc*.key setf named au BufNewFile,BufRead named.root setf bindzone au BufNewFile,BufRead *.db call dist#ft#BindzoneCheck('') +" Blade +au BufNewFile,BufRead *.blade.php setf blade + " Blank au BufNewFile,BufRead *.bl setf blank diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim index e2f2f045bb..778e840d0e 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -122,6 +122,7 @@ def s:GetFilenameChecks(): dict> bicep: ['file.bicep'], bindzone: ['named.root', '/bind/db.file', '/named/db.file', 'any/bind/db.file', 'any/named/db.file'], bitbake: ['file.bb', 'file.bbappend', 'file.bbclass', 'build/conf/local.conf', 'meta/conf/layer.conf', 'build/conf/bbappend.conf', 'meta-layer/conf/distro/foo.conf'], + blade: ['file.blade.php'], blank: ['file.bl'], blueprint: ['file.blp'], bsdl: ['file.bsd', 'file.bsdl'], diff --git a/src/version.c b/src/version.c index 8e470ef7a8..e5b4844855 100644 --- a/src/version.c +++ b/src/version.c @@ -695,6 +695,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1678, /**/ 1677, /**/ From 84bc00e9b52b1174888f2f696f8b628a83c49988 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Thu, 13 Jul 2023 11:45:54 +0200 Subject: [PATCH 002/163] patch 9.0.1679: Cleanup Tests from leftover files Problem: Tests may leave leftover files around Solution: Clean up tests and remove files There were a few failures in 'linux (huge, gcc, testgui, true, true)' e.g. here: https://github.com/vim/vim/actions/runs/5497376153/jobs/10018060156 ,---- | Error detected while processing command line..script /home/runner/work/vim/vim/src/testdir/runtest.vim[585]..function RunTheTest[54]..Test_lvimgrep_crash[16]..TestTimeout[12]..VimLeavePre Autocommands for "*"..function EarlyExit[7]..FinishTesting: | line 70: | E445: Other window contains changes | E937: Attempt to delete a buffer that is in use: Xtest_stable_xxd.txt | E937: Attempt to delete a buffer that is in use: Xtest_stable_xxd.txt | E937: Attempt to delete a buffer that is in use: Xtest_stable_xxd.txtmalloc(): unsorted double linked list corrupted `---- Which is puzzling, because the Xtest_stable_xxd file should have been long gone after test_crypt.vim is run (and definitely no longer be staying around in test_quickfix.vim). So try to clean up properly after a test script is run, just in case any X is still around. During testing, a found a few leftover files, which I also fixed in the relevant test-file. Unfortunately, the test workflow 'linux (huge, gcc, testgui, true, true)' now seems to fail with 'E1230: Encryption: sodium_mlock()' in test_crypt.vim. Hopefully this is only temporary. --- src/testdir/runtest.vim | 22 +++++++++++++++++++--- src/testdir/test_mksession.vim | 2 ++ src/testdir/test_terminal.vim | 3 +++ src/version.c | 2 ++ 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/testdir/runtest.vim b/src/testdir/runtest.vim index e2bc28d374..0d79bef3bf 100644 --- a/src/testdir/runtest.vim +++ b/src/testdir/runtest.vim @@ -411,6 +411,24 @@ func RunTheTest(test) endif endfunc +function Delete_Xtest_Files() + for file in glob('X*', v:false, v:true) + if file ==? 'XfakeHOME' + " Clean up files created by setup.vim + call delete('XfakeHOME', 'rf') + continue + endif + " call add(v:errors, file .. " exists when it shouldn't, trying to delete it!") + call delete(file) + if !empty(glob(file, v:false, v:true)) + " call add(v:errors, file .. " still exists after trying to delete it!") + if has('unix') + call system('rm -rf ' .. file) + endif + endif + endfor +endfunc + func AfterTheTest(func_name) if len(v:errors) > 0 if match(s:may_fail_list, '^' .. a:func_name) >= 0 @@ -439,13 +457,11 @@ endfunc " This function can be called by a test if it wants to abort testing. func FinishTesting() call AfterTheTest('') + call Delete_Xtest_Files() " Don't write viminfo on exit. set viminfo= - " Clean up files created by setup.vim - call delete('XfakeHOME', 'rf') - if s:fail == 0 && s:fail_expected == 0 " Success, create the .res file so that make knows it's done. exe 'split ' . fnamemodify(g:testname, ':r') . '.res' diff --git a/src/testdir/test_mksession.vim b/src/testdir/test_mksession.vim index aa291821ec..5485e144fb 100644 --- a/src/testdir/test_mksession.vim +++ b/src/testdir/test_mksession.vim @@ -973,6 +973,7 @@ func Test_mksession_foldopt() close %bwipe set sessionoptions& + call delete('Xtest_mks.out') endfunc " Test for mksession with "help" but not "options" in 'sessionoptions' @@ -1105,6 +1106,7 @@ func Test_mksession_shortmess_with_A() set shortmess& set sessionoptions& call delete('Xtestsession') + call delete('Xtestfile') endfunc " Test for mksession with 'compatible' option diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim index da263f4558..bb6fca3acf 100644 --- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -309,6 +309,7 @@ func Test_terminal_rename_buffer() call assert_equal('bar', bufname()) call assert_match('bar.*finished', execute('ls')) exe 'bwipe! ' .. buf + call delete('Xtext') endfunc func s:Nasty_exit_cb(job, st) @@ -1045,6 +1046,8 @@ func Test_terminal_redir_file() call WaitForAssert({-> assert_equal('dead', job_status(g:job))}) bwipe endif + + call delete('Xtext') endfunc func TerminalTmap(remap) diff --git a/src/version.c b/src/version.c index e5b4844855..f2e714ca44 100644 --- a/src/version.c +++ b/src/version.c @@ -695,6 +695,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1679, /**/ 1678, /**/ From 8f566fdb1e3452c9104d9e7af402adbfbcb463c7 Mon Sep 17 00:00:00 2001 From: Linda_pp Date: Wed, 9 Aug 2023 23:45:52 +0900 Subject: [PATCH 003/163] update .wast files syntax highlighting (#12741) --- runtime/syntax/wast.vim | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/runtime/syntax/wast.vim b/runtime/syntax/wast.vim index 245d5f6f19..113d65c5a1 100644 --- a/runtime/syntax/wast.vim +++ b/runtime/syntax/wast.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: WebAssembly " Maintainer: rhysd -" Last Change: Jul 29, 2018 +" Last Change: Aug 7, 2023 " For bugs, patches and license go to https://github.com/rhysd/vim-wasm if exists("b:current_syntax") @@ -11,33 +11,42 @@ endif let s:cpo_save = &cpo set cpo&vim -syn cluster wastCluster contains=wastModule,wastInstWithType,wastInstGeneral,wastParamInst,wastControlInst,wastString,wastNamedVar,wastUnnamedVar,wastFloat,wastNumber,wastComment,wastList,wastType +syn cluster wastNotTop contains=wastModule,wastInstWithType,wastInstGetSet,wastInstGeneral,wastParamInst,wastControlInst,wastSimdInst,wastString,wastNamedVar,wastUnnamedVar,wastFloat,wastNumber,wastComment,wastList,wastType " Instructions " https://webassembly.github.io/spec/core/text/instructions.html " Note: memarg (align=,offset=) can be added to memory instructions syn match wastInstWithType "\%((\s*\)\@<=\<\%(i32\|i64\|f32\|f64\|memory\)\.[[:alnum:]_]\+\%(/\%(i32\|i64\|f32\|f64\)\)\=\>\%(\s\+\%(align\|offset\)=\)\=" contained display syn match wastInstGeneral "\%((\s*\)\@<=\<[[:alnum:]_]\+\>" contained display +syn match wastInstGetSet "\%((\s*\)\@<=\<\%(local\|global\)\.\%(get\|set\)\>" contained display " https://webassembly.github.io/spec/core/text/instructions.html#control-instructions -syn match wastControlInst "\%((\s*\)\@<=\<\%(block\|end\|loop\|if\|else\|unreachable\|nop\|br\|br_if\|br_table\|return\|call\|call_indirect\)\>" contained display +syn match wastControlInst "\%((\s*\)\@<=\<\%(block\|end\|loop\|if\|then\|else\|unreachable\|nop\|br\|br_if\|br_table\|return\|call\|call_indirect\)\>" contained display " https://webassembly.github.io/spec/core/text/instructions.html#parametric-instructions syn match wastParamInst "\%((\s*\)\@<=\<\%(drop\|select\)\>" contained display +" SIMD instructions +" https://webassembly.github.io/simd/core/text/instructions.html#simd-instructions +syn match wastSimdInst "\<\%(v128\|i8x16\|i16x8\|i32x4\|i64x2\|f32x4\|f64x2)\)\.[[:alnum:]_]\+\%(\s\+\%(i8x16\|i16x8\|i32x4\|i64x2\|f32x4\|f64x2\)\)\=\>" contained display " Identifiers " https://webassembly.github.io/spec/core/text/values.html#text-id -syn match wastNamedVar "$\+[[:alnum:]!#$%&'∗./:=>" display contained " Comments " https://webassembly.github.io/spec/core/text/lexical.html#comments -syn region wastComment start=";;" end="$" display +syn region wastComment start=";;" end="$" syn region wastComment start="(;;\@!" end=";)" -syn region wastList matchgroup=wastListDelimiter start="(;\@!" matchgroup=wastListDelimiter end=";\@ Date: Wed, 9 Aug 2023 16:49:01 +0200 Subject: [PATCH 004/163] Add WebGPU Shading Language (WGSL) filetype (#12723) The current W3C Working Draft for the WebGPU Shading Language (WGSL) specifies 'text/wgsl' media type for WGSL modules with the '.wgsl' file extension: https://www.w3.org/TR/WGSL/#text-wgsl-media-type It has also been registered at the Internet Assigned Numbers Authority (IANA): https://www.iana.org/assignments/media-types/text/wgsl Neovim's nvim-lspconfig already associates wgsl language servers with 'filetype wgsl': https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#wgsl_analyzer However currenly setting 'filetype wgsl' for *.wgsl files by defalut in Neovim is blocked by adding this filetype to the vim project first: https://github.com/neovim/neovim/pull/23331 This commit adds this missing wgsl filetype. --- runtime/filetype.vim | 3 +++ src/testdir/test_filetype.vim | 1 + 2 files changed, 4 insertions(+) diff --git a/runtime/filetype.vim b/runtime/filetype.vim index d0ee535f58..f63a1461a1 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -2399,6 +2399,9 @@ au BufNewFile,BufRead .wgetrc,wgetrc setf wget " Wget2 config au BufNewFile,BufRead .wget2rc,wget2rc setf wget2 +" WebGPU Shading Language (WGSL) +au BufNewFile,BufRead *.wgsl setf wgsl + " Website MetaLanguage au BufNewFile,BufRead *.wml setf wml diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim index 778e840d0e..1540f92fd8 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -775,6 +775,7 @@ def s:GetFilenameChecks(): dict> webmacro: ['file.wm'], wget: ['.wgetrc', 'wgetrc'], wget2: ['.wget2rc', 'wget2rc'], + wgsl: ['file.wgsl'], winbatch: ['file.wbt'], wit: ['file.wit'], wml: ['file.wml'], From 8967f6c4b9e2071dea9a63dbbbb93f6b9119ae99 Mon Sep 17 00:00:00 2001 From: Chris Vincent Date: Wed, 9 Aug 2023 09:49:44 -0500 Subject: [PATCH 005/163] feat(heex): borrow matchit support from html (#12717) * feat(heex): borrow matchit support from html Makes % support behave the same in heex as in html. For example, quickly moving the cursor between opening and closing tags. * Remove unnecessary line; define b:undo_ftplugin first * Remove b:html_set_match_words --- runtime/ftplugin/heex.vim | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/runtime/ftplugin/heex.vim b/runtime/ftplugin/heex.vim index 5274d59fbf..f79c69d2aa 100644 --- a/runtime/ftplugin/heex.vim +++ b/runtime/ftplugin/heex.vim @@ -14,3 +14,14 @@ setlocal comments=:<%!-- setlocal commentstring=<%!--\ %s\ --%> let b:undo_ftplugin = 'set sw< sts< et< com< cms<' + +" HTML: thanks to Johannes Zellner and Benji Fisher. +if exists("loaded_matchit") && !exists("b:match_words") + let b:match_ignorecase = 1 + let b:match_words = ',' .. + \ '<:>,' .. + \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' .. + \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' .. + \ '<\@<=\([^/!][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>' + let b:undo_ftplugin ..= " | unlet! b:match_ignorecase b:match_words" +endif From 7159ac7fec282ad7427795b4bcd5b769268c083d Mon Sep 17 00:00:00 2001 From: Anton Parkhomenko Date: Wed, 9 Aug 2023 21:50:52 +0700 Subject: [PATCH 006/163] Unison support (#12715) --- runtime/filetype.vim | 3 + runtime/ftplugin/unison.vim | 14 +++++ runtime/syntax/unison.vim | 103 ++++++++++++++++++++++++++++++++++ src/testdir/test_filetype.vim | 1 + 4 files changed, 121 insertions(+) create mode 100644 runtime/ftplugin/unison.vim create mode 100644 runtime/syntax/unison.vim diff --git a/runtime/filetype.vim b/runtime/filetype.vim index f63a1461a1..dd7e3bc9bd 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -2490,6 +2490,9 @@ au BufNewFile,BufRead *.fsproj,*.fsproj.user setf xml " VBPROJ files are Visual Studio.NET's XML-based Visual Basic project config files au BufNewFile,BufRead *.vbproj,*.vbproj.user setf xml +" Unison Language +au BufNewFile,BufRead *.u,*.uu setf unison + " Qt Linguist translation source and Qt User Interface Files are XML " However, for .ts TypeScript is more common. au BufNewFile,BufRead *.ui setf xml diff --git a/runtime/ftplugin/unison.vim b/runtime/ftplugin/unison.vim new file mode 100644 index 0000000000..76dbaef6aa --- /dev/null +++ b/runtime/ftplugin/unison.vim @@ -0,0 +1,14 @@ +" Vim filetype plugin file +" Language: unison +" Maintainer: Anton Parkhomenko +" Latest Revision: 2023-08-07 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let b:undo_ftplugin = "setl cms< isk<" + +setlocal commentstring=--\ %s +setlocal iskeyword+=!,' diff --git a/runtime/syntax/unison.vim b/runtime/syntax/unison.vim new file mode 100644 index 0000000000..fed7551043 --- /dev/null +++ b/runtime/syntax/unison.vim @@ -0,0 +1,103 @@ +" Vim syntax file +" +" Language: unison +" Maintainer: Anton Parkhomenko +" Last Change: Aug 7, 2023 +" Original Author: John Williams, Paul Chiusano and Rúnar Bjarnason + +if exists("b:current_syntax") + finish +endif + +syntax include @markdown $VIMRUNTIME/syntax/markdown.vim + +syn cluster markdownLikeDocs contains=markdownBold,markdownItalic,markdownLinkText,markdownListMarker,markdownOrderedListMarker,markdownH1,markdownH2,markdownH3,markdownH4,markdownH5,markdownH6 + +syn match unisonOperator "[-!#$%&\*\+/<=>\?@\\^|~]" +syn match unisonDelimiter "[\[\](){},.]" + +" Strings and constants +syn match unisonSpecialChar contained "\\\([0-9]\+\|o[0-7]\+\|x[0-9a-fA-F]\+\|[\"\\'&\\abfnrtv]\|^[A-Z^_\[\\\]]\)" +syn match unisonSpecialChar contained "\\\(NUL\|SOH\|STX\|ETX\|EOT\|ENQ\|ACK\|BEL\|BS\|HT\|LF\|VT\|FF\|CR\|SO\|SI\|DLE\|DC1\|DC2\|DC3\|DC4\|NAK\|SYN\|ETB\|CAN\|EM\|SUB\|ESC\|FS\|GS\|RS\|US\|SP\|DEL\)" +syn match unisonSpecialCharError contained "\\&\|'''\+" +syn region unisonString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=unisonSpecialChar +syn match unisonCharacter "[^a-zA-Z0-9_']'\([^\\]\|\\[^']\+\|\\'\)'"lc=1 contains=unisonSpecialChar,unisonSpecialCharError +syn match unisonCharacter "^'\([^\\]\|\\[^']\+\|\\'\)'" contains=unisonSpecialChar,unisonSpecialCharError +syn match unisonNumber "\<[0-9]\+\>\|\<0[xX][0-9a-fA-F]\+\>\|\<0[oO][0-7]\+\>" +syn match unisonFloat "\<[0-9]\+\.[0-9]\+\([eE][-+]\=[0-9]\+\)\=\>" + +" Keyword definitions. These must be patterns instead of keywords +" because otherwise they would match as keywords at the start of a +" "literate" comment (see lu.vim). +syn match unisonModule "\" +syn match unisonImport "\" +syn match unisonTypedef "\<\(unique\|structural\|∀\|forall\)\>" +syn match unisonStatement "\<\(ability\|do\|type\|where\|match\|cases\|;\|let\|with\|handle\)\>" +syn match unisonConditional "\<\(if\|else\|then\)\>" + +syn match unisonBoolean "\<\(true\|false\)\>" + +syn match unisonType "\<\C[A-Z][0-9A-Za-z_'!]*\>" +syn match unisonName "\<\C[a-z_][0-9A-Za-z_'!]*\>" + +" Comments +syn match unisonLineComment "---*\([^-!#$%&\*\+./<=>\?@\\^|~].*\)\?$" +syn region unisonBlockComment start="{-" end="-}" contains=unisonBlockComment +syn region unisonBelowFold start="^---" skip="." end="." contains=unisonBelowFold + +" Docs +syn region unisonDocBlock matchgroup=unisonDoc start="{{" end="}}" contains=unisonDocTypecheck,unisonDocQuasiquote,unisonDocDirective,unisonDocCode,unisonDocCodeInline,unisonDocCodeRaw,unisonDocMono,@markdownLikeDocs +syn region unisonDocQuasiquote contained matchgroup=unisonDocQuote start="{{" end= "}}" contains=TOP +syn region unisonDocCode contained matchgroup=unisonDocCode start="^\s*```\s*$" end="^\s*```\s*$" contains=TOP +syn region unisonDocTypecheck contained matchgroup=unisonDocCode start="^\s*@typecheck\s*```\s*$" end="^\s*```\s*$" contains=TOP +syn region unisonDocCodeRaw contained matchgroup=unisonDocCode start="^\s*```\s*raw\s*$" end="^\s*```\s*$" contains=NoSyntax +syn region unisonDocCodeInline contained matchgroup=unisonDocCode start="`\@" + +" things like +" > my_func 1 3 +" test> Function.tap.tests.t1 = check let +" use Nat == + +" ( 99, 100 ) === (withInitialValue 0 do +" : : : +syn match unisonWatch "^[A-Za-z]*>" + +hi def link unisonWatch Debug +hi def link unisonDocMono Delimiter +hi def link unisonDocDirective Import +hi def link unisonDocQuote Delimiter +hi def link unisonDocCode Delimiter +hi def link unisonDoc String +hi def link unisonBelowFold Comment +hi def link unisonBlockComment Comment +hi def link unisonBoolean Boolean +hi def link unisonCharacter Character +hi def link unisonComment Comment +hi def link unisonConditional Conditional +hi def link unisonConditional Conditional +hi def link unisonDebug Debug +hi def link unisonDelimiter Delimiter +hi def link unisonDocBlock String +hi def link unisonDocDirective Import +hi def link unisonDocIncluded Import +hi def link unisonFloat Float +hi def link unisonImport Include +hi def link unisonLineComment Comment +hi def link unisonLink Type +hi def link unisonName Identifier +hi def link unisonNumber Number +hi def link unisonOperator Operator +hi def link unisonSpecialChar SpecialChar +hi def link unisonSpecialCharError Error +hi def link unisonStatement Statement +hi def link unisonString String +hi def link unisonType Type +hi def link unisonTypedef Typedef + + +let b:current_syntax = "unison" + +" Options for vi: ts=8 sw=2 sts=2 nowrap noexpandtab ft=vim diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim index 1540f92fd8..d5422bc301 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -742,6 +742,7 @@ def s:GetFilenameChecks(): dict> udevperm: ['/etc/udev/permissions.d/file.permissions', 'any/etc/udev/permissions.d/file.permissions'], udevrules: ['/etc/udev/rules.d/file.rules', '/usr/lib/udev/rules.d/file.rules', '/lib/udev/rules.d/file.rules'], uil: ['file.uit', 'file.uil'], + unison: ['file.u', 'file.uu'], updatedb: ['/etc/updatedb.conf', 'any/etc/updatedb.conf'], upstart: ['/usr/share/upstart/file.conf', '/usr/share/upstart/file.override', '/etc/init/file.conf', '/etc/init/file.override', '/.init/file.conf', '/.init/file.override', '/.config/upstart/file.conf', '/.config/upstart/file.override', 'any/.config/upstart/file.conf', 'any/.config/upstart/file.override', 'any/.init/file.conf', 'any/.init/file.override', 'any/etc/init/file.conf', 'any/etc/init/file.override', 'any/usr/share/upstart/file.conf', 'any/usr/share/upstart/file.override'], upstreamdat: ['upstream.dat', 'UPSTREAM.DAT', 'upstream.file.dat', 'UPSTREAM.FILE.DAT', 'file.upstream.dat', 'FILE.UPSTREAM.DAT'], From 44ff25d5243b6d4f7ee88b46d1254aec0b27f4eb Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Wed, 9 Aug 2023 17:52:33 +0300 Subject: [PATCH 007/163] PyPA manifest files are not recognized (#12707) Problem: PyPA manifest files are not recognized. Solution: Add a pattern to match PyPA manifest files. --- runtime/filetype.vim | 3 +++ src/testdir/test_filetype.vim | 1 + 2 files changed, 4 insertions(+) diff --git a/runtime/filetype.vim b/runtime/filetype.vim index dd7e3bc9bd..5d24849219 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1679,6 +1679,9 @@ au BufNewFile,BufRead *.pk setf poke " Protocols au BufNewFile,BufRead */etc/protocols setf protocols +" PyPA manifest files +au BufNewFile,BufRead MANIFEST.in setf pymanifest + " Pyret au BufNewFile,BufRead *.arr setf pyret diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim index d5422bc301..4e13712be1 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -544,6 +544,7 @@ def s:GetFilenameChecks(): dict> psl: ['file.psl'], pug: ['file.pug'], puppet: ['file.pp'], + pymanifest: ['MANIFEST.in'], pyret: ['file.arr'], pyrex: ['file.pyx', 'file.pxd'], python: ['file.py', 'file.pyw', '.pythonstartup', '.pythonrc', 'file.ptl', 'file.pyi', 'SConstruct'], From 2eb413f89b97a498679fbe68c7564b9e41c5af7f Mon Sep 17 00:00:00 2001 From: Turiiya <34311583+ttytm@users.noreply.github.com> Date: Wed, 9 Aug 2023 17:04:59 +0200 Subject: [PATCH 008/163] detect filetype for `*.vsh` and `*.vv` files (#12692) Co-authored-by: Turiiya <34311583+tobealive@users.noreply.github.com> --- runtime/filetype.vim | 3 +++ src/testdir/test_filetype.vim | 1 + 2 files changed, 4 insertions(+) diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 5d24849219..6d2d55e3c7 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -2320,6 +2320,9 @@ au BufNewFile,BufRead */.config/upstart/*.override setf upstart " URL shortcut au BufNewFile,BufRead *.url setf urlshortcut +" V +au BufNewFile,BufRead *.vsh,*.vv setf v + " Vala au BufNewFile,BufRead *.vala setf vala diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim index 4e13712be1..a044b62926 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -753,6 +753,7 @@ def s:GetFilenameChecks(): dict> usd: ['file.usda', 'file.usd'], usserverlog: ['usserver.log', 'USSERVER.LOG', 'usserver.file.log', 'USSERVER.FILE.LOG', 'file.usserver.log', 'FILE.USSERVER.LOG'], usw2kagtlog: ['usw2kagt.log', 'USW2KAGT.LOG', 'usw2kagt.file.log', 'USW2KAGT.FILE.LOG', 'file.usw2kagt.log', 'FILE.USW2KAGT.LOG'], + v: ['file.vsh', 'file.vv'], vala: ['file.vala'], vb: ['file.sba', 'file.vb', 'file.vbs', 'file.dsm', 'file.ctl'], vdf: ['file.vdf'], From 958e15bb1c7d582cdca324dc61a4daf5c01842bc Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Wed, 9 Aug 2023 18:05:39 +0300 Subject: [PATCH 009/163] Highlight editorconfig properties with dashes (#12691) Problem: editorconfig properties with dashes are not highlighted Solution: update the property pattern to include dashes --- runtime/syntax/editorconfig.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/syntax/editorconfig.vim b/runtime/syntax/editorconfig.vim index 6740624bc3..7f75ab6287 100644 --- a/runtime/syntax/editorconfig.vim +++ b/runtime/syntax/editorconfig.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: EditorConfig " Maintainer: Gregory Anders -" Last Change: 2023-01-03 +" Last Change: 2023-07-20 if exists('b:current_syntax') finish @@ -10,7 +10,7 @@ endif runtime! syntax/dosini.vim unlet! b:current_syntax -syntax match editorconfigUnknownProperty "^\s*\zs\w\+\ze\s*=" +syntax match editorconfigUnknownProperty "^\s*\zs[a-zA-Z0-9_-]\+\ze\s*=" syntax keyword editorconfigProperty root charset end_of_line indent_style syntax keyword editorconfigProperty indent_size tab_width max_line_length From b69b9d5e175351c9a25507139954f6211f37fdd9 Mon Sep 17 00:00:00 2001 From: Max Gautier Date: Wed, 9 Aug 2023 17:18:36 +0200 Subject: [PATCH 010/163] Add filetype detection for eyaml files (#12659) https://github.com/voxpupuli/hiera-eyaml/ uses and produces the eyaml format, which is simply yaml with some encrypted values. It's convenient to edit the file without decrypting when not touching encrypted values (or when you don't have access to the decryption key), which is why vim should treat those files as yaml files. --- runtime/filetype.vim | 2 +- src/testdir/test_filetype.vim | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 6d2d55e3c7..4808a56d8e 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -2544,7 +2544,7 @@ au BufNewFile,BufRead *.yy,*.yxx,*.y++ setf yacc au BufNewFile,BufRead *.y call dist#ft#FTy() " Yaml -au BufNewFile,BufRead *.yaml,*.yml setf yaml +au BufNewFile,BufRead *.yaml,*.yml,*.eyaml setf yaml " Raml au BufNewFile,BufRead *.raml setf raml diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim index a044b62926..7125360da1 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -799,7 +799,7 @@ def s:GetFilenameChecks(): dict> xsd: ['file.xsd'], xslt: ['file.xsl', 'file.xslt'], yacc: ['file.yy', 'file.yxx', 'file.y++'], - yaml: ['file.yaml', 'file.yml', '.clangd', '.clang-format', '.clang-tidy'], + yaml: ['file.yaml', 'file.yml', 'file.eyaml', '.clangd', '.clang-format', '.clang-tidy'], yang: ['file.yang'], yuck: ['file.yuck'], z8a: ['file.z8a'], From 077ade4f67036e652b99f8f858c9ca1c1dd22245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominique=20Pell=C3=A9?= Date: Wed, 9 Aug 2023 17:36:40 +0200 Subject: [PATCH 011/163] feat: recognize geojson extension as json filetype (#12636) --- runtime/filetype.vim | 3 +++ src/testdir/test_filetype.vim | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 4808a56d8e..49e602fab1 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1060,6 +1060,9 @@ au BufNewFile,BufRead *.json5 setf json5 " JSON Patch (RFC 6902) au BufNewFile,BufRead *.json-patch setf json +" Geojson is also json +au BufNewFile,BufRead *.geojson setf json + " Jupyter Notebook is also json au BufNewFile,BufRead *.ipynb setf json diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim index 7125360da1..25bfdeb004 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -340,7 +340,7 @@ def s:GetFilenameChecks(): dict> jq: ['file.jq'], jovial: ['file.jov', 'file.j73', 'file.jovial'], jproperties: ['file.properties', 'file.properties_xx', 'file.properties_xx_xx', 'some.properties_xx_xx_file', 'org.eclipse.xyz.prefs'], - json: ['file.json', 'file.jsonp', 'file.json-patch', 'file.webmanifest', 'Pipfile.lock', 'file.ipynb', '.prettierrc', '.firebaserc', '.stylelintrc', 'file.slnf'], + json: ['file.json', 'file.jsonp', 'file.json-patch', 'file.geojson', 'file.webmanifest', 'Pipfile.lock', 'file.ipynb', '.prettierrc', '.firebaserc', '.stylelintrc', 'file.slnf'], json5: ['file.json5'], jsonc: ['file.jsonc', '.babelrc', '.eslintrc', '.jsfmtrc', '.jshintrc', '.hintrc', '.swrc', 'jsconfig.json', 'tsconfig.json', 'tsconfig.test.json', 'tsconfig-test.json'], jsonl: ['file.jsonl'], From 0401933a5be3b72e12427cdaf8b7ff2694690d02 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 9 Aug 2023 23:39:05 +0800 Subject: [PATCH 012/163] Fix alignment in filetype.txt (#12618) There are three spaces because the "<" is concealed. --- runtime/doc/filetype.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt index ae8e6584aa..05574eba22 100644 --- a/runtime/doc/filetype.txt +++ b/runtime/doc/filetype.txt @@ -394,7 +394,7 @@ ways to change this: You must create a new filetype plugin in a directory early in 'runtimepath'. For Unix, for example you could use this file: > vim ~/.vim/ftplugin/fortran.vim -< You can set those settings and mappings that you would like to add. Note +< You can set those settings and mappings that you would like to add. Note that the global plugin will be loaded after this, it may overrule the settings that you do here. If this is the case, you need to use one of the following two methods. @@ -403,7 +403,7 @@ ways to change this: You must put the copy in a directory early in 'runtimepath'. For Unix, for example, you could do this: > cp $VIMRUNTIME/ftplugin/fortran.vim ~/.vim/ftplugin/fortran.vim -< Then you can edit the copied file to your liking. Since the b:did_ftplugin +< Then you can edit the copied file to your liking. Since the b:did_ftplugin variable will be set, the global plugin will not be loaded. A disadvantage of this method is that when the distributed plugin gets improved, you will have to copy and modify it again. @@ -412,7 +412,7 @@ ways to change this: You must create a new filetype plugin in a directory from the end of 'runtimepath'. For Unix, for example, you could use this file: > vim ~/.vim/after/ftplugin/fortran.vim -< In this file you can change just those settings that you want to change. +< In this file you can change just those settings that you want to change. ============================================================================== 3. Docs for the default filetype plugins. *ftplugin-docs* From bd76c89e31ac9d9efd00ec8dda9c32436415dbbb Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Wed, 9 Aug 2023 17:39:53 +0200 Subject: [PATCH 013/163] update matchit (#12611) --- .../dist/opt/matchit/autoload/matchit.vim | 17 +-- runtime/pack/dist/opt/matchit/doc/matchit.txt | 27 ++++- .../pack/dist/opt/matchit/plugin/matchit.vim | 103 +++++++++++------- 3 files changed, 96 insertions(+), 51 deletions(-) diff --git a/runtime/pack/dist/opt/matchit/autoload/matchit.vim b/runtime/pack/dist/opt/matchit/autoload/matchit.vim index eafb7c0551..dc2aba696d 100644 --- a/runtime/pack/dist/opt/matchit/autoload/matchit.vim +++ b/runtime/pack/dist/opt/matchit/autoload/matchit.vim @@ -1,6 +1,6 @@ " matchit.vim: (global plugin) Extended "%" matching " autload script of matchit plugin, see ../plugin/matchit.vim -" Last Change: Jun 10, 2021 +" Last Change: Jan 24, 2022 " Neovim does not support scriptversion if has("vimscript-4") @@ -42,6 +42,10 @@ function s:RestoreOptions() let restore_options = " ve=" .. &ve .. restore_options set ve= endif + if &smartcase + let restore_options = " smartcase " .. restore_options + set nosmartcase + endif return restore_options endfunction @@ -134,9 +138,6 @@ function matchit#Match_wrapper(word, forward, mode) range let curcol = match(matchline, regexp) " If there is no match, give up. if curcol == -1 - " Make sure macros abort properly - "exe "norm! \" - call feedkeys("\e", 'tni') return s:CleanUp(restore_options, a:mode, startpos) endif let endcol = matchend(matchline, regexp) @@ -756,15 +757,15 @@ endfun fun! s:ParseSkip(str) let skip = a:str if skip[1] == ":" - if skip[0] == "s" + if skip[0] ==# "s" let skip = "synIDattr(synID(line('.'),col('.'),1),'name') =~? '" .. \ strpart(skip,2) .. "'" - elseif skip[0] == "S" + elseif skip[0] ==# "S" let skip = "synIDattr(synID(line('.'),col('.'),1),'name') !~? '" .. \ strpart(skip,2) .. "'" - elseif skip[0] == "r" + elseif skip[0] ==# "r" let skip = "strpart(getline('.'),0,col('.'))=~'" .. strpart(skip,2) .. "'" - elseif skip[0] == "R" + elseif skip[0] ==# "R" let skip = "strpart(getline('.'),0,col('.'))!~'" .. strpart(skip,2) .. "'" endif endif diff --git a/runtime/pack/dist/opt/matchit/doc/matchit.txt b/runtime/pack/dist/opt/matchit/doc/matchit.txt index 52f448f787..d072d59aea 100644 --- a/runtime/pack/dist/opt/matchit/doc/matchit.txt +++ b/runtime/pack/dist/opt/matchit/doc/matchit.txt @@ -1,10 +1,10 @@ -*matchit.txt* Extended "%" matching +*matchit.txt* Extended "%" matching For instructions on installing this file, type `:help matchit-install` inside Vim. -For Vim version 8.2. Last change: 2021 Dec 24 +For Vim version 9.0. Last change: 2023 June 28 VIM REFERENCE MANUAL by Benji Fisher et al @@ -148,10 +148,6 @@ To use the matchit plugin add this line to your |vimrc|: > The script should start working the next time you start Vim. -To use the matching plugin after startup, you can use this command (note the -omitted '!'): > - packadd matchit - To use the matchit plugin after Vim has started, execute this command: > packadd matchit @@ -176,6 +172,22 @@ fail to skip matching groups in comments and strings. If the |filetype| mechanism is turned off, the |b:match_words| variable will probably not be defined automatically. +2.1 Temporarily disable the matchit plugin *matchit-disable* *:MatchDisable* + +To temporarily reset the plugins, that are setup you can run the following +command: > + :MatchDisable + +This will delete all the defined key mappings to the Vim default. +Now the "%" command will work like before loading the plugin |%| + +2.2 Re-enable the matchit plugin *:MatchEnable* + +To re-enable the plugin, after it was disabled, use the following command: > + :MatchEnable + +This will resetup the key mappings. + ============================================================================== 3. Configuration *matchit-configure* @@ -244,6 +256,9 @@ Examples: comment character) you can > :let b:match_skip = 'r:\(^\|[^\\]\)\(\\\\\)*%' < + See the $VIMRUNTIME/ftplugin/vim.vim for an example that uses both + syntax and a regular expression. + ============================================================================== 4. Supporting a New Language *matchit-newlang* *b:match_words* diff --git a/runtime/pack/dist/opt/matchit/plugin/matchit.vim b/runtime/pack/dist/opt/matchit/plugin/matchit.vim index 51ba3a7f51..d6c735d7b4 100644 --- a/runtime/pack/dist/opt/matchit/plugin/matchit.vim +++ b/runtime/pack/dist/opt/matchit/plugin/matchit.vim @@ -1,7 +1,7 @@ " matchit.vim: (global plugin) Extended "%" matching " Maintainer: Christian Brabandt -" Version: 1.18 -" Last Change: 2020 Dec 23 +" Version: 1.19 +" Last Change: 2023, June 28th " Repository: https://github.com/chrisbra/matchit " Previous URL:http://www.vim.org/script.php?script_id=39 " Previous Maintainer: Benji Fisher PhD @@ -46,44 +46,65 @@ let g:loaded_matchit = 1 let s:save_cpo = &cpo set cpo&vim -nnoremap (MatchitNormalForward) :call matchit#Match_wrapper('',1,'n') -nnoremap (MatchitNormalBackward) :call matchit#Match_wrapper('',0,'n') -xnoremap (MatchitVisualForward) :call matchit#Match_wrapper('',1,'v') - \:if col("''") != col("$") \| exe ":normal! m'" \| endifgv`` -xnoremap (MatchitVisualBackward) :call matchit#Match_wrapper('',0,'v')m'gv`` -onoremap (MatchitOperationForward) :call matchit#Match_wrapper('',1,'o') -onoremap (MatchitOperationBackward) :call matchit#Match_wrapper('',0,'o') - -" Analogues of [{ and ]} using matching patterns: -nnoremap (MatchitNormalMultiBackward) :call matchit#MultiMatch("bW", "n") -nnoremap (MatchitNormalMultiForward) :call matchit#MultiMatch("W", "n") -xnoremap (MatchitVisualMultiBackward) :call matchit#MultiMatch("bW", "n")m'gv`` -xnoremap (MatchitVisualMultiForward) :call matchit#MultiMatch("W", "n")m'gv`` -onoremap (MatchitOperationMultiBackward) :call matchit#MultiMatch("bW", "o") -onoremap (MatchitOperationMultiForward) :call matchit#MultiMatch("W", "o") - -" text object: -xmap (MatchitVisualTextObject) (MatchitVisualMultiBackward)o(MatchitVisualMultiForward) - -if !exists("g:no_plugin_maps") - nmap % (MatchitNormalForward) - nmap g% (MatchitNormalBackward) - xmap % (MatchitVisualForward) - xmap g% (MatchitVisualBackward) - omap % (MatchitOperationForward) - omap g% (MatchitOperationBackward) +fun MatchEnable() + nnoremap (MatchitNormalForward) :call matchit#Match_wrapper('',1,'n') + nnoremap (MatchitNormalBackward) :call matchit#Match_wrapper('',0,'n') + xnoremap (MatchitVisualForward) :call matchit#Match_wrapper('',1,'v') + \:if col("''") != col("$") \| exe ":normal! m'" \| endifgv`` + xnoremap (MatchitVisualBackward) :call matchit#Match_wrapper('',0,'v')m'gv`` + onoremap (MatchitOperationForward) :call matchit#Match_wrapper('',1,'o') + onoremap (MatchitOperationBackward) :call matchit#Match_wrapper('',0,'o') " Analogues of [{ and ]} using matching patterns: - nmap [% (MatchitNormalMultiBackward) - nmap ]% (MatchitNormalMultiForward) - xmap [% (MatchitVisualMultiBackward) - xmap ]% (MatchitVisualMultiForward) - omap [% (MatchitOperationMultiBackward) - omap ]% (MatchitOperationMultiForward) + nnoremap (MatchitNormalMultiBackward) :call matchit#MultiMatch("bW", "n") + nnoremap (MatchitNormalMultiForward) :call matchit#MultiMatch("W", "n") + xnoremap (MatchitVisualMultiBackward) :call matchit#MultiMatch("bW", "n")m'gv`` + xnoremap (MatchitVisualMultiForward) :call matchit#MultiMatch("W", "n")m'gv`` + onoremap (MatchitOperationMultiBackward) :call matchit#MultiMatch("bW", "o") + onoremap (MatchitOperationMultiForward) :call matchit#MultiMatch("W", "o") - " Text object - xmap a% (MatchitVisualTextObject) -endif + " text object: + xmap (MatchitVisualTextObject) (MatchitVisualMultiBackward)o(MatchitVisualMultiForward) + + if !exists("g:no_plugin_maps") + nmap % (MatchitNormalForward) + nmap g% (MatchitNormalBackward) + xmap % (MatchitVisualForward) + xmap g% (MatchitVisualBackward) + omap % (MatchitOperationForward) + omap g% (MatchitOperationBackward) + + " Analogues of [{ and ]} using matching patterns: + nmap [% (MatchitNormalMultiBackward) + nmap ]% (MatchitNormalMultiForward) + xmap [% (MatchitVisualMultiBackward) + xmap ]% (MatchitVisualMultiForward) + omap [% (MatchitOperationMultiBackward) + omap ]% (MatchitOperationMultiForward) + + " Text object + xmap a% (MatchitVisualTextObject) + endif +endfun + +fun MatchDisable() + " remove all the setup keymappings + nunmap % + nunmap g% + xunmap % + xunmap g% + ounmap % + ounmap g% + + nunmap [% + nunmap ]% + xunmap [% + xunmap ]% + ounmap [% + ounmap ]% + + xunmap a% +endfun " Call this function to turn on debugging information. Every time the main " script is run, buffer variables will be saved. These can be used directly @@ -91,6 +112,14 @@ endif if !exists(":MatchDebug") command! -nargs=0 MatchDebug call matchit#Match_debug() endif +if !exists(":MatchDisable") + command! -nargs=0 MatchDisable :call MatchDisable() +endif +if !exists(":MatchEnable") + command! -nargs=0 MatchEnable :call MatchEnable() +endif + +call MatchEnable() let &cpo = s:save_cpo unlet s:save_cpo From 64dea84bb05a29117cf2708085021c535b898975 Mon Sep 17 00:00:00 2001 From: Filip Gospodinov Date: Wed, 9 Aug 2023 18:00:36 +0200 Subject: [PATCH 014/163] Manpager: apply g flag conditionally to s command (#12679) Problem: The `s` command with `g` flag only substitutes one occurrence when `gdefault` is set. Solution: Use `g` flag conditionally. --- runtime/plugin/manpager.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/plugin/manpager.vim b/runtime/plugin/manpager.vim index 1738dc9439..076aca5f83 100644 --- a/runtime/plugin/manpager.vim +++ b/runtime/plugin/manpager.vim @@ -30,10 +30,10 @@ function s:ManPager() setlocal modifiable " Emulate 'col -b' - silent! keepj keepp %s/\v(.)\b\ze\1?//ge + exe 'silent! keepj keepp %s/\v(.)\b\ze\1?//e' .. (&gdefault ? '' : 'g') " Remove ansi sequences - silent! keepj keepp %s/\v\e\[%(%(\d;)?\d{1,2})?[mK]//ge + exe 'silent! keepj keepp %s/\v\e\[%(%(\d;)?\d{1,2})?[mK]//e' .. (&gdefault ? '' : 'g') " Remove empty lines above the header call cursor(1, 1) From c2bd205254c89ecf46e08965f53d7991315d9c98 Mon Sep 17 00:00:00 2001 From: Daniel Steinberg Date: Wed, 9 Aug 2023 12:10:59 -0400 Subject: [PATCH 015/163] Change "the" to "then" under ':help bufload()' (#12662) --- runtime/doc/builtin.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index e7a0392cc8..34f76d6f4e 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -1,4 +1,4 @@ -*builtin.txt* For Vim version 9.0. Last change: 2023 Jun 08 +*builtin.txt* For Vim version 9.0. Last change: 2023 Aug 09 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1249,7 +1249,7 @@ bufload({buf}) *bufload()* refers to an existing file then the file is read. Otherwise the buffer will be empty. If the buffer was already loaded then there is no change. If the buffer is not related to a - file the no file is read (e.g., when 'buftype' is "nofile"). + file then no file is read (e.g., when 'buftype' is "nofile"). If there is an existing swap file for the file of the buffer, there will be no dialog, the buffer will be loaded anyway. The {buf} argument is used like with |bufexists()|. From 335c58494089ff4ef698f059ded6215f69c02bcf Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Wed, 9 Aug 2023 16:32:28 +0200 Subject: [PATCH 016/163] patch 9.0.1680: sodium test fails in Github CI Problem: sodium test fails in Github CI Solution: Catch sodium_mlock() errors and do not error out sodium_mlock() seems to fail consistently on the Github CI. Perhaps [sodium_mlock()](https://libsodium.gitbook.io/doc/memory_management#text-locking-memory) is called too often or with too much memory by the runners so that this starts failing. Let's just try to catch this and skip the test, when this starts happening. closes: #12751 --- src/testdir/test_crypt.vim | 20 +++++++++++++++++--- src/version.c | 2 ++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/testdir/test_crypt.vim b/src/testdir/test_crypt.vim index 8f1041449c..944f2165bb 100644 --- a/src/testdir/test_crypt.vim +++ b/src/testdir/test_crypt.vim @@ -189,7 +189,11 @@ func Test_uncrypt_xchacha20v2_custom() 00000060: a4cf 33d2 7507 ec38 ba62 a327 9068 d8ad ..3.u..8.b.'.h.. 00000070: 2607 3fa6 f95d 7ea8 9799 f997 4820 0c &.?..]~.....H . END - call Uncrypt_stable_xxd('xchacha20v2', hex, "foobar", ["", "foo", "bar", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"], 1) + try + call Uncrypt_stable_xxd('xchacha20v2', hex, "foobar", ["", "foo", "bar", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"], 1) + catch /^Vim\%((\a\+)\)\=:E1230:/ " sodium_mlock() not possible, may happen at Github CI + throw 'Skipped: sodium_mlock() not possible' + endtry call assert_match('xchacha20v2: using custom \w\+ "\d\+" for Key derivation.', execute(':messages')) endfunc @@ -209,7 +213,11 @@ func Test_uncrypt_xchacha20v2() 00000090: 2416 205a 8c4c 5fde 4dac 2611 8a48 24f0 $. Z.L_.M.&..H$. 000000a0: ba00 92c1 60 ....` END - call Uncrypt_stable_xxd('xchacha20v2', hex, "foo1234", ["abcdefghijklmnopqrstuvwxyzäöü", 'ZZZ_äüöÄÜÖ_!@#$%^&*()_+=-`~"'], 0) + try + call Uncrypt_stable_xxd('xchacha20v2', hex, "foo1234", ["abcdefghijklmnopqrstuvwxyzäöü", 'ZZZ_äüöÄÜÖ_!@#$%^&*()_+=-`~"'], 0) + catch /^Vim\%((\a\+)\)\=:E1230:/ " sodium_mlock() not possible, may happen at Github CI + throw 'Skipped: sodium_mlock() not possible' + endtry endfunc func Test_uncrypt_xchacha20_invalid() @@ -220,6 +228,8 @@ func Test_uncrypt_xchacha20_invalid() try call feedkeys(":split samples/crypt_sodium_invalid.txt\sodium\", 'xt') call assert_false(1, 'should not happen') + catch /^Vim\%((\a\+)\)\=:E1230:/ " sodium_mlock() not possible, may happen at Github CI + throw 'Skipped: sodium_mlock() not possible' catch call assert_exception('pre-mature') endtry @@ -272,7 +282,11 @@ func Test_uncrypt_xchacha20v2_2() " swapfile disabled call assert_equal(0, &swapfile) call assert_match("Note: Encryption of swapfile not supported, disabling swap file", execute(':messages')) - w! + try + w! + catch /^Vim\%((\a\+)\)\=:E1230:/ " sodium_mlock() not possible, may happen at Github CI + throw 'Skipped: sodium_mlock() not possible' + endtry " encrypted using xchacha20 call assert_match("\[xchachav2\]", execute(':messages')) bw! diff --git a/src/version.c b/src/version.c index f2e714ca44..cc86bb60de 100644 --- a/src/version.c +++ b/src/version.c @@ -695,6 +695,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1680, /**/ 1679, /**/ From 1d7caa58e3c87f75a4becbceabbd1af181ace11e Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Thu, 22 Jun 2023 08:55:47 +0200 Subject: [PATCH 017/163] patch 9.0.1681: Build Failure with Perl 5.38 Problem: Build Failure with Perl 5.38 Solution: Fix Build Failure closes: #12543, closes: #12575 --- .github/workflows/ci.yml | 1 - ci/config.mk.sed | 2 +- src/if_perl.xs | 14 +++++++------- src/version.c | 2 ++ 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3481bcb8fc..47c68ea7d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -276,7 +276,6 @@ jobs: run: | brew install lua echo "LUA_PREFIX=/usr/local" >> $GITHUB_ENV - brew uninstall perl - name: Set up environment run: | diff --git a/ci/config.mk.sed b/ci/config.mk.sed index 51e7ec903d..f672edd9e4 100644 --- a/ci/config.mk.sed +++ b/ci/config.mk.sed @@ -1,3 +1,3 @@ /^CFLAGS[[:blank:]]*=/s/$/ -Wall -Wextra -Wshadow -Werror/ -/^PERL_CFLAGS_EXTRA[[:blank:]]*=/s/$/ -Wno-error=unused-function/ +/^PERL_CFLAGS_EXTRA[[:blank:]]*=/s/$/ -Wno-error=unused-function -Wno-shadow/ /^RUBY_CFLAGS_EXTRA[[:blank:]]*=/s/$/ -Wno-error=unused-parameter/ diff --git a/src/if_perl.xs b/src/if_perl.xs index c69ed9ef1f..6c1003c411 100644 --- a/src/if_perl.xs +++ b/src/if_perl.xs @@ -40,7 +40,7 @@ /* Work around for perl-5.18. * Don't include "perl\lib\CORE\inline.h" for now, * include it after Perl_sv_free2 is defined. */ -#ifdef DYNAMIC_PERL +#if (PERL_REVISION == 5) && (PERL_VERSION >= 18) # define PERL_NO_INLINE_FUNCTIONS #endif @@ -402,14 +402,14 @@ static bool (*Perl_sv_2bool)(pTHX_ SV*); static IV (*Perl_sv_2iv)(pTHX_ SV*); static SV* (*Perl_sv_2mortal)(pTHX_ SV*); # if (PERL_REVISION == 5) && (PERL_VERSION >= 8) -static char* (*Perl_sv_2pv_flags)(pTHX_ SV*, STRLEN*, I32); +static char* (*Perl_sv_2pv_flags)(pTHX_ SV*, STRLEN* const, const U32); static char* (*Perl_sv_2pv_nolen)(pTHX_ SV*); # else static char* (*Perl_sv_2pv)(pTHX_ SV*, STRLEN*); # endif static char* (*Perl_sv_2pvbyte)(pTHX_ SV*, STRLEN*); # if (PERL_REVISION == 5) && (PERL_VERSION >= 32) -static char* (*Perl_sv_2pvbyte_flags)(pTHX_ SV*, STRLEN*, I32); +static char* (*Perl_sv_2pvbyte_flags)(pTHX_ SV*, STRLEN* const, const U32); # endif static SV* (*Perl_sv_bless)(pTHX_ SV*, HV*); # if (PERL_REVISION == 5) && (PERL_VERSION >= 8) @@ -710,7 +710,7 @@ S_POPMARK(pTHX) # endif /* perl-5.34 needs Perl_SvTRUE_common; used in SvTRUE_nomg_NN */ -# if (PERL_REVISION == 5) && (PERL_VERSION >= 34) +# if (PERL_REVISION == 5) && (PERL_VERSION == 34) PERL_STATIC_INLINE bool Perl_SvTRUE_common(pTHX_ SV * sv, const bool sv_2bool_is_fallback) { @@ -737,7 +737,7 @@ Perl_SvTRUE_common(pTHX_ SV * sv, const bool sv_2bool_is_fallback) # endif /* perl-5.32 needs Perl_SvTRUE */ -# if (PERL_REVISION == 5) && (PERL_VERSION >= 32) +# if (PERL_REVISION == 5) && (PERL_VERSION == 32) PERL_STATIC_INLINE bool Perl_SvTRUE(pTHX_ SV *sv) { if (!LIKELY(sv)) @@ -1649,7 +1649,7 @@ Buffers(...) PPCODE: if (items == 0) { - if (GIMME == G_SCALAR) + if (GIMME_V == G_SCALAR) { i = 0; FOR_ALL_BUFFERS(vimbuf) @@ -1700,7 +1700,7 @@ Windows(...) PPCODE: if (items == 0) { - if (GIMME == G_SCALAR) + if (GIMME_V == G_SCALAR) XPUSHs(sv_2mortal(newSViv(win_count()))); else { diff --git a/src/version.c b/src/version.c index cc86bb60de..39f637c185 100644 --- a/src/version.c +++ b/src/version.c @@ -695,6 +695,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1681, /**/ 1680, /**/ From c41b3c9f95ac57646804977edea496705618cc93 Mon Sep 17 00:00:00 2001 From: Balki Date: Fri, 14 Jul 2023 16:59:40 +0000 Subject: [PATCH 018/163] defaults.vim: Update comment to simplify reverting augroup closes: #12673 --- runtime/defaults.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/defaults.vim b/runtime/defaults.vim index 9b4ecfeafa..67659895f2 100644 --- a/runtime/defaults.vim +++ b/runtime/defaults.vim @@ -97,7 +97,7 @@ if 1 filetype plugin indent on " Put these in an autocmd group, so that you can revert them with: - " ":augroup vimStartup | exe 'au!' | augroup END" + " ":autocmd! vimStartup" augroup vimStartup au! @@ -115,7 +115,7 @@ if 1 " Quite a few people accidentally type "q:" instead of ":q" and get confused " by the command line window. Give a hint about how to get out. " If you don't like this you can put this in your vimrc: - " ":augroup vimHints | exe 'au!' | augroup END" + " ":autocmd! vimHints" augroup vimHints au! autocmd CmdwinEnter * From 6ec7808c4a469d1fe22101f75e4d9abc269823a6 Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Wed, 9 Aug 2023 13:11:37 -0500 Subject: [PATCH 019/163] Add security policy (#12687) * Add security policy Currently is hard to find where to report security issues, the only mention of it is in the issue template. https://github.com/vim/vim/blob/4c0089d696b8d1d5dc40568f25ea5738fa5bbffb/.github/ISSUE_TEMPLATE/bug_report.yml?plain=1#L12-L15 Adding a SECURITY.md file will make it easier to find, it will be displayed in https://github.com/vim/vim/security. * Mention that reports are private --- SECURITY.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000000..7d9c77d275 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,8 @@ +# Security Policy + +## Reporting a vulnerability + +If you want to report a security issue, please use [huntr.dev](https://huntr.dev/bounties/disclose?target=https%3A%2F%2Fgithub.com%2Fvim%2Fvim) to privately disclose the issue to us. +They also have rewards in the form of money, swag and CVEs. + +**Please don't publicly disclose the issue until it has been addressed by us.** From 92f076e53e22b467fb6d12051fec2d4bdbda88fe Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski <31903021+KnoP-01@users.noreply.github.com> Date: Wed, 9 Aug 2023 20:35:35 +0200 Subject: [PATCH 020/163] Update krl and add rapid syntax files (#12750) --- runtime/syntax/krl.vim | 21 +- runtime/syntax/rapid.vim | 687 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 699 insertions(+), 9 deletions(-) create mode 100644 runtime/syntax/rapid.vim diff --git a/runtime/syntax/krl.vim b/runtime/syntax/krl.vim index a50790841e..6808a48fc4 100644 --- a/runtime/syntax/krl.vim +++ b/runtime/syntax/krl.vim @@ -2,7 +2,7 @@ " Language: Kuka Robot Language " Maintainer: Patrick Meiser-Knosowski " Version: 3.0.0 -" Last Change: 18. Apr 2022 +" Last Change: 22. Jun 2023 " Credits: Thanks for contributions to this to Michael Jagusch " Thanks for beta testing to Thomas Baginski " @@ -109,11 +109,11 @@ highlight default link krlGeomOperator Operator " Type, StorageClass and Typedef {{{ " Simple data types -syn keyword krlType bool char real int containedin=krlAnyType +syn keyword krlType bool char real int " External program and function -syn keyword krlType ext extfct extfctp extp containedin=krlAnyType +syn keyword krlType ext extfct extfctp extp " Communication -syn keyword krlType signal channel containedin=krlAnyType +syn keyword krlType signal channel highlight default link krlType Type " StorageClass syn keyword krlStorageClass decl global const struc enum @@ -200,19 +200,20 @@ syn keyword krlEnum adap_acc model_type control_parameter eko_mode " " Predefined structures and enums found in /steu/mada/$custom.dat syn keyword krlStructure pro_io_t ser ext_mod_t coop_krc ws_config bin_type coop_update_t ldc_reaction -syn keyword krlEnum axis_of_coordinates spline_para_variant target_status cp_vel_type cp_statmon +syn keyword krlEnum axis_of_coordinates motion_mode spline_para_variant spreadstartpolicy target_status cp_vel_type cp_statmon " " Predefined structures and enums found in /steu/mada/$machine.dat syn keyword krlStructure emstop_path boxstatesafein boxstatesafeout syn keyword krlEnum digincode " " Predefined structures and enums found in /steu/mada/$option.dat -syn keyword krlStructure msg_t +syn keyword krlStructure installed_motion_modes msg_t +syn keyword krlEnum step_enum " syn keyword krlEnum " " Predefined structures and enums found in /r1/system/$config.dat " BasisTech -syn keyword krlStructure dig_out_type ctrl_in_t ctrl_out_t fct_out_t fct_in_t odat basis_sugg_t out_sugg_t md_state machine_def_t machine_tool_t machine_frame_t trigger_para constvel_para condstop_para adat tm_sugg_t tqm_tqdat_t sps_prog_type +syn keyword krlStructure dig_out_type ctrl_in_t ctrl_out_t fct_out_t fct_in_t odat hdat basis_sugg_t out_sugg_t md_state machine_def_t machine_tool_t machine_frame_t trigger_para constvel_para condstop_para adat tm_sugg_t tqm_tqdat_t sps_prog_type syn keyword krlEnum bas_command out_modetype ipo_m_t apo_mode_t funct_type p00_command timer_actiontype " " GripperTech @@ -271,7 +272,9 @@ highlight default link krlStatement Statement syn keyword krlConditional if then else endif switch case default endswitch skip endskip highlight default link krlConditional Conditional " Repeat -syn keyword krlRepeat for to step endfor while endwhile repeat until loop endloop exit +syn keyword krlRepeat for to endfor while endwhile repeat until loop endloop exit +" STEP is used as variable in VKRC, this pattern should match STEP -, 5(constant number) or VAR +syn match krlRepeat /\v\cstep\s+%(-|\w)/me=e-1 highlight default link krlRepeat Repeat " Label syn keyword krlLabel goto @@ -390,7 +393,7 @@ if get(g:, 'krlShowError', 1) " some more or less common typos " " vars or funcs >24 chars are not possible in krl. a234567890123456789012345 - syn match krlError0 /\w\{25,}/ containedin=krlFunction,krlNames,krlLabel,krlAnyType,krlEnumVal,krlSysvars + syn match krlError0 /\w\{25,}/ containedin=krlFunction,krlNames,krlLabel,krlEnumVal,krlSysvars " " should be interrupt (on|off) \w+ syn match krlError1 /\vinterrupt[ \t(]+[_$a-zA-Z0-9]+[_$a-zA-Z0-9.\[\]()+\-*/]*[ \t)]+o%(n|ff)>/ diff --git a/runtime/syntax/rapid.vim b/runtime/syntax/rapid.vim new file mode 100644 index 0000000000..ed0da095c0 --- /dev/null +++ b/runtime/syntax/rapid.vim @@ -0,0 +1,687 @@ +" ABB Rapid Command syntax file for Vim +" Language: ABB Rapid Command +" Maintainer: Patrick Meiser-Knosowski +" Version: 2.3.0 +" Last Change: 21. Jul 2023 +" Credits: Thanks for beta testing to Thomas Baginski +" +" Suggestions of improvement are very welcome. Please email me! +" +" +" +" Note to self: +" for testing perfomance +" open a 1000 lines file. +" :syntime on +" G +" hold down CTRL-U until reaching top +" :syntime report +" +" +" TODO: - highlight rapid constants and maybe constants from common +" technology packages +" - optimize rapidErrorStringTooLong +" - error highlight for missing 2nd point in MoveCirc et al + +" Init {{{ +" Remove any old syntax stuff that was loaded (5.x) or quit when a syntax file +" was already loaded (6.x). +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +let s:keepcpo= &cpo +set cpo&vim + +" if colorscheme is tortus rapidNoHighLink defaults to 1 +if (get(g:,'colors_name'," ")=="tortus" || get(g:,'colors_name'," ")=="tortusless") + \&& !exists("g:rapidGroupName") + let g:rapidGroupName=1 +endif +" rapidGroupName defaults to 0 if it's not initialized yet or 0 +if !get(g:,"rapidGroupName",0) + let g:rapidGroupName=0 +endif + +" Rapid does ignore case +syn case ignore +" spell checking +syn spell notoplevel +" }}} init + +" common highlighting {{{ + +" Error {{{ +if get(g:,'rapidShowError',1) + " + " This error must be defined befor rapidCharCode and rapidEscapedBackSlash + " a string containing a single \ which is not a char code + syn match rapidErrorSingleBackslash /\\/ contained + highlight default link rapidErrorSingleBackslash Error + " +endif +" }}} Error + +" Constant values {{{ +" Boolean +syn keyword rapidBoolean TRUE FALSE Edge High Low +highlight default link rapidBoolean Boolean +" Float (num) +" syn match rapidFloat /\v%(\W|_)@1<=[+-]?\d+\.?\d*%(\s*[eE][+-]?\d+)?/ +syn match rapidFloat /\v\c%(<\d+\.|\.?<\d)\d*%(E[+-]?\d+)?>/ contains=rapidOperator +highlight default link rapidFloat Float +" integer in decimal, hexadecimal, octal and binary +syn match rapidDec /\<[0-9]\+\>/ +highlight default link rapidDec Number +syn match rapidHex /\<0x[0-9a-fA-F]\+\>/ +highlight default link rapidHex Number +syn match rapidOct /\<0o[0-7]\+\>/ +highlight default link rapidOct Number +syn match rapidBin /\<0b[01]\+\>/ +highlight default link rapidBin Number +" String. Note: Don't rename group rapidString. Indent depend on this +syn region rapidString matchgroup=rapidString start=/"/ skip=/""/ end=/"/ oneline contains=rapidStringDoubleQuote,rapidEscapedBackSlash,rapidCharCode,rapidErrorSingleBackslash,rapidErrorStringTooLong,@Spell +highlight default link rapidString String +" two adjacent "" in string for one double quote +syn match rapidStringDoubleQuote /""/ contained +highlight default link rapidStringDoubleQuote SpecialChar +" character code in string +syn match rapidCharCode /\\\x\x/ contained +highlight default link rapidCharCode SpecialChar +" escaped \ in string +syn match rapidEscapedBackSlash /\\\\/ contained +highlight default link rapidEscapedBackSlash SpecialChar +" }}} Constant values + +" }}} common highlighting + +if bufname("%") =~ '\c\.cfg$' +" {{{ highlighting for *.cfg + + " special chars {{{ + " syn match rapidOperator /:\|[+-]\|\*\|\/\|\\/ + syn match rapidOperator /[-+*/:\\]/ + syn match rapidOperator /^#/ + highlight default link rapidOperator Operator + " }}} special chars + + " sections {{{ + syn match rapidException /^\w\+/ + syn match rapidException /CFG_\d\+/ + highlight default link rapidException Exception + " }}} sections + + " Error {{{ + if get(g:,'rapidShowError',1) + " + " This error must be defined after rapidString + " Any Name longer than 32 chars + syn match rapidErrorNameTooLong /-Name "[^"]\{33,}"/ + highlight default link rapidErrorNameTooLong Error + " + endif + " }}} Error + + " }}} highlighting for *.cfg +else + " highlighting for *.mod, *.sys and *.prg {{{ + + " sync for regions from a line comment or the start of a function + syn sync match rapidSync grouphere NONE /\v\c^\s*%(!|%(task\s+|local\s+)?%(module|proc|func|trap|record)>)/ + + " Comment {{{ + " TODO Comment + syn match rapidTodoComment contained /\\|\\|\/ + highlight default link rapidTodoComment Todo + " Debug comment + syn match rapidDebugComment contained /\/ + highlight default link rapidDebugComment Debug + " Line comment + syn match rapidComment /!.*$/ contains=rapidTodoComment,rapidDebugComment,@Spell + highlight default link rapidComment Comment + " }}} Comment + + " Header {{{ + syn match rapidHeader /^%%%/ + highlight default link rapidHeader PreProc + " }}} Header + + " Operator {{{ + " Boolean operator + syn keyword rapidOperator and or xor not div mod + " Arithmetic and compare operator + syn match rapidOperator /[-+*/<>:=]/ + " conditional argument + syn match rapidOperator /?/ + highlight default link rapidOperator Operator + " }}} Operator + + " Type, StorageClass and Typedef {{{ + " anytype (preceded by 'alias|pers|var|const|func' + " TODO: still missing are userdefined types which are part of a parameter: + " PROC message( mystring msMessagePart1{}, + " \ myvar msMsg4{}) + " TODO testing. Problem: does not highlight any type if it's part of an argument list + " syn match rapidAnyType /\v^\s*(global\s+|task\s+|local\s+)?(alias|pers|var|const|func)\s+\w+>/ contains=rapidStorageClass,rapidType,rapidTypeDef + " highlight default link rapidAnyType Type + syn keyword rapidType accdata aiotrigg bool btnres busstate buttondata byte + syn keyword rapidType cfgdomain clock cnvcmd confdata confsupdata corrdescr datapos deflectiondata dionum dir dnum + syn keyword rapidType egmframetype egmident egm_minmax egmstate egmstopmode errdomain errnum ErrorInfo errstr errtype event_type exec_level extjoint handler_type + syn keyword rapidType icondata identno inposdata intnum inttypes iodev iounit_state jointtarget + syn keyword rapidType listitem loaddata loadidnum loadsession mecunit motionprocessmode motsetdata + " syn keyword rapidType num + syn keyword rapidType opcalc opnum orient paridnum paridvalidnum pathrecid pnpdata pos pose proc_times progdisp o_jointtarget o_robtarget + syn keyword rapidType rawbytes restartdata rmqheader rmqmessage rmqslot robjoint robtarget + syn keyword rapidType searchdata sensor sensorstate sensorvardata shapedata signalai signalao signaldi signaldo signalgi signalgo signalorigin singdata socketdev socketstatus speeddata stopmovestartmove_mem stoppoint stoppointdata string stringdig sup_timeouts supervtype switch symnum syncident + syn keyword rapidType taskid tasks tasksatstart testsignal tooldata tpnum trapdata triggdata triggflag triggios triggiosdnum triggmode triggstrgo tsp_status tunegtype tunetype + syn keyword rapidType uishownum veldata visiondata wobjdata wzstationary wztemporary zonedata + " SoftMove data types + syn keyword rapidType css_offset_dir css_soft_dir cssframe + " arc data types + syn keyword rapidType advSeamData arcdata flystartdata seamdata arctrackdata opttrackdata weavedata welddata + " conveyor tracking data types + syn keyword rapidType indcnvdata + " Integrated Vision data types + syn keyword rapidType cameradev cameratarget + " arc Weldguide and MultiPass data types + syn keyword rapidType adaptdata trackdata multidata + " dispense data types + syn keyword rapidType beaddata equipdata + " Spot data types + syn keyword rapidType gundata gunnum spotdata forcedata simdata smeqdata smeqtype + " Tool change data types + syn keyword rapidType standno ToolInfo toolno + " Continuous Application Platform data types + syn keyword rapidType capaptrreferencedata capdata capevent caplatrackdata capmvsttim capspeeddata capspeeddata capstopmode captestno captrackdata capweavedata flypointdata processtimes restartblkdata supervtimeouts weavestartdata + " Bulls Eye data types + syn keyword rapidType be_device be_scan be_tooldesign + " Force Control data types + syn keyword rapidType fcboxvol fccondstatus fccylindervol fcdamping fcforcevector fcframe fclindir fcprocessdata fcplane fcrotdir fcspeedvector fcspherevol fcspdchgtunetype fcxyznum + " Discrete application platform data types + syn keyword rapidType dadescapp dadescprc daintdata + " VW Konzernstandard VWKS_1.07.02 + syn keyword rapidType merker + syn keyword rapidType frgnum frgwert robnum + syn keyword rapidType fmnum applid calibdatavorr stepdata + syn keyword rapidType tsmethode tsdaten teilspeicherdaten + syn keyword rapidType greiferdaten greiferposition bauteildaten bauteilkontrolle g_datenident g_sensor g_signal g_teilident g_ventil + syn keyword rapidType strgnum typnum + syn keyword rapidType hubnum kopfnum + syn keyword rapidType applservicetype + syn keyword rapidType applfraesdaten kwdionum + syn keyword rapidType butechnum + syn keyword rapidType toolnum dbnum + " das folgende sind datentypen aber das kann man doch nicht machen... + " syn keyword rapidType position wert + syn keyword rapidType camdata camlimitdata cammode camprotocoldata camstatus camsequence campositionstatus + syn keyword rapidType saposnum sabereichnum autofocusnum focusposnum lascaledata laleistungnum larobnum laprognum uebwnum dgbanum dgjobnum gasspuelnum davalve gasuebwnum + syn keyword rapidType lsfigurnum lsstarttype + syn keyword rapidType lwprognum lwdiodnum lsstarttype + syn keyword rapidType lztype diskrethubnum lztipnum + syn keyword rapidType gblmethod + syn keyword rapidType buatypenum buatechnum buadirnum + highlight default link rapidType Type + " Storage class + syn keyword rapidStorageClass LOCAL TASK VAR PERS CONST ALIAS NOVIEW NOSTEPIN VIEWONLY READONLY SYSMODULE INOUT + highlight default link rapidStorageClass StorageClass + " Not a typedef but I like to have those highlighted different then types, + " structures or strorage classes + syn keyword rapidTypeDef MODULE ENDMODULE PROC ERROR UNDO BACKWARD ENDPROC RECORD ENDRECORD TRAP ENDTRAP FUNC ENDFUNC + highlight default link rapidTypeDef TypeDef + " }}} Type, StorageClass and Typedef + + " Statements, keywords et al {{{ + " syn keyword rapidStatement + " highlight default link rapidStatement Statement + " Conditional + syn keyword rapidConditional if then elseif else endif test case default endtest + highlight default link rapidConditional Conditional + " Repeat + syn keyword rapidRepeat do + syn match rapidRepeat /\c\v^\s*%(|)%([^!]+)@=/ + syn keyword rapidRepeat from to step endfor endwhile + highlight default link rapidRepeat Repeat + " Label + syn keyword rapidLabel goto + syn match rapidLabel /\c\v^\s*[[:upper:][:lower:]]\k*\:\ze%([^=]|$)/ contains=rapidConditional,rapidOperator + highlight default link rapidLabel Label + " Keyword + syn keyword rapidKeyword AccSet ActEventBuffer ActUnit Add AliasCamera AliasIO AliasIOReset BitClear BitSet BookErrNo BrakeCheck + syn keyword rapidKeyword CallByVar CancelLoad CheckProgRef CirPathMode Clear ClearIOBuff ClearPath ClearRawBytes ClkReset ClkStart ClkStop Close CloseDir ConfJ ConfL CONNECT CopyFile CopyRawBytes CornerPathWarning CorrClear CorrCon CorrDiscon CorrWrite + syn keyword rapidKeyword CSSAct CSSDeact CSSForceOffsetAct CSSForceOffsetDeact CSSOffsetTune CyclicBrakeCheck + syn keyword rapidKeyword DeactEventBuffer DeactUnit Decr DitherAct DitherDeact DropSensor + syn keyword rapidKeyword EGMActJoint EGMActMove EGMActPose EGMGetId EGMReset EGMSetupAI EGMSetupAO EGMSetupGI EGMSetupLTAPP EGMSetupUC EOffsOff EOffsOn EOffsSet EraseModule ErrLog ErrWrite + syn keyword rapidKeyword FitCircle FricIdInit FricIdEvaluate FricIdSetFricLevels + syn keyword rapidKeyword GetDataVal GetGroupSignalInfo GetJointData GetSysData GetTorqueMargin GetTrapData GripLoad HollowWristReset + syn keyword rapidKeyword IDelete IDisable IEnable IError Incr IndReset InvertDO IOBusStart IOBusState IoCtrlAxis_RefSync IoCtrlAxis_RefSyncOff IoCtrlAxis_RefSyncOn IODisable IOEnable IPers IRMQMessage ISignalAI ISignalAO ISignalDI ISignalDO ISignalGI ISignalGO ISleep ITimer IVarValue IWatch + syn keyword rapidKeyword Load LoadId MakeDir ManLoadIdProc MatrixSolve MatrixSolveQR MatrixSVD MechUnitLoad MotionProcessModeSet MotionSup MToolRotCalib MToolTCPCalib Open OpenDir + syn keyword rapidKeyword PackDNHeader PackRawBytes PathAccLim PathLengthReset PathLengthStart PathLengthStop PathRecStart PathRecStop PathResol PDispOff PDispOn PDispSet ProcerrRecovery PrxActivAndStoreRecord PrxActivRecord PrxDbgStoreRecord PrxDeactRecord PrxResetPos PrxResetRecords PrxSetPosOffset PrxSetRecordSampleTime PrxSetSyncalarm PrxStartRecord PrxStopRecord PrxStoreRecord PrxUseFileRecord PulseDO + syn keyword rapidKeyword ReadAnyBin ReadBlock ReadCfgData ReadErrData ReadRawBytes ReadVarArr RemoveAllCyclicBool RemoveCyclicBool RemoveDir RemoveFile RenameFile Reset ResetAxisDistance ResetAxisMoveTime ResetPPMoved ResetRetryCount ResetTorqueMargin RestoPath Rewind RMQEmptyQueue RMQFindSlot RMQGetMessage RMQGetMsgData RMQGetMsgHeader RMQReadWait RMQSendMessage RMQSendWait + syn keyword rapidKeyword SafetyControllerSyncRequest Save SaveCfgData SCWrite SenDevice Set SetAllDataVal SetAO SetDataSearch SetDataVal SetDO SetGO SetLeadThrough SetSysData SetupCyclicBool SiConnect SiClose SiGetCyclic SingArea SiSetCyclic SkipWarn SocketAccept SocketBind SocketClose SocketConnect SocketCreate SocketListen SocketReceive SocketReceiveFrom SocketSend SocketSendTo SoftAct SoftDeact SoftElbow SpeedLimAxis SpeedLimCheckPoint SpeedRefresh SpyStart SpyStop StartLoad STCalib STClose STIndGun STIndGunReset SToolRotCalib SToolTCPCalib STOpen StorePath STTune STTuneReset SupSyncSensorOff SupSyncSensorOn SyncMoveOff SyncMoveOn SyncMoveResume SyncMoveSuspend SyncMoveUndo SyncToSensor SystemStopAction + syn keyword rapidKeyword TestSignDefine TestSignReset TextTabInstall TPErase TPReadDnum TPReadFK TPReadNum TPShow TPWrite TriggCheckIO TriggDataCopy TriggDataReset TriggEquip TriggInt TriggIO TriggRampAO TriggSpeed TriggStopProc TryInt TuneReset TuneServo + syn keyword rapidKeyword UIMsgBox UIMsgWrite UIMsgWriteAbort UIShow UnLoad UnpackRawBytes VelSet WaitAI WaitAO WaitDI WaitDO WaitGI WaitGO WaitLoad WaitRob WaitSensor WaitSyncTask WaitTestAndSet WaitTime WaitUntil WarmStart WITH WorldAccLim Write WriteAnyBin WriteBin WriteBlock WriteCfgData WriteRawBytes WriteStrBin WriteVar WriteVarArr WZBoxDef WZCylDef WZDisable WZDOSet WZEnable WZFree WZHomeJointDef WZLimJointDef WZLimSup WZSphDef + " arc instructions + syn keyword rapidKeyword ArcRefresh RecoveryMenu RecoveryMenuWR RecoveryPosSet RecoveryPosReset SetWRProcName + " conveyor tracking instructions + syn keyword rapidKeyword UseACCProfile WaitWObj DropWObj RecordProfile WaitAndRecProf StoreProfile LoadProfile ActivateProfile DeactProfile CnvGenInstr CnvSync CnvGenInstr IndCnvInit IndCnvEnable IndCnvDisable IndCnvReset IndCnvAddObject + syn keyword rapidKeyword UseReachableTargets GetMaxUsageTime ResetMaxUsageTime CnvPredictReach + " Integrated Vision instructions + syn keyword rapidKeyword CamFlush CamGetParameter CamGetResult CamLoadJob CamReqImage CamSetExposure CamSetParameter CamSetProgramMode CamSetRunMode CamStartLoadJob CamWaitLoadJob + " arc Weldguide and MultiPass instructions + syn keyword rapidKeyword MPSavePath MPLoadPath MPReadInPath MPOffsEaxOnPath + " Paint instructions + syn keyword rapidKeyword ConsoleWrite IpsSetParam PntProdUserLog SetBrush SetBrushFac + " Spot instructions + syn keyword rapidKeyword SetForce Calibrate ReCalcTCP IndGunMove IndGunMoveReset OpenHighLift CloseHighLift SwSetIntSpotData SwSetIntForceData SwSetIntGunData SwSetIntSimData SwGetCalibData SwGetFixTipData + " Tool change instructions + syn keyword rapidKeyword TcCloseCover TcDropOffTool TcLockTool TcOpenCover TcPickupTool TcUnlockTool + " dispense instructions + syn keyword rapidKeyword SetTmSignal SyncWWObj + " Continuous Application Platform instructions + syn keyword rapidKeyword CapAPTrSetup CapAPTrSetupAI CapAPTrSetupAO CapAPTrSetupPERS CapCondSetDO CapEquiDist CapNoProcess CapRefresh CAPSetStopMode CapWeaveSync ICap InitSuperv IPathPos RemoveSuperv SetupSuperv + " Bulls Eye instructions + syn keyword rapidKeyword BECheckTcp BEDebugState BERefPointer BESetupToolJ BETcpExtend BEUpdateTcp + " Force Control instructions + syn keyword rapidKeyword FCAct FCCalib FCCondForce FCCondOrient FCCondPos FCCondReoriSpeed FCCondTCPSpeed FCCondTorque FCCondWaitWhile FCDeact FCPress1LStart FCPressC FCPressEnd FCPressL FCRefCircle FCRefForce FCRefLine FCRefMoveFrame FCRefRot FCRefSpiral FCRefSprForceCart FCRefStart FCRefStop FCRefTorque FCResetDampingTune FCResetLPFilterTune FCSpdChgAct FCSpdChgDeact FCSpdChgTunSet FCSpdChgTunReset FCSetDampingTune FCSetLPFilterTune FCSupvForce FCSupvOrient FCSupvPos FCSupvReoriSpeed FCSupvTCPSpeed FCSupvTorque + " Discrete application platform instructions + syn keyword rapidKeyword DaActProc DaDeactAllProc DaDeactProc DaDefExtSig DaDefProcData DaDefProcSig DaDefUserData DaGetCurrData DaSetCurrData DaSetupAppBehav DaStartManAction DaGetAppDescr DaGetAppIndex DaGetNumOfProcs DaGetNumOfRob DaGetPrcDescr + " Production Manager instructions + syn keyword rapidKeyword ExecEngine PMgrGetNextPart PMgrSetNextPart PMgrRunMenu + " Homepos-Running instructions + syn keyword rapidKeyword HR_Exit HR_ExitCycle HR_SavePos HR_SetMoveToStartPos HR_SetTypeDIndex HR_SetTypeIndex + highlight default link rapidKeyword Keyword + " Exception + syn keyword rapidException Exit ErrRaise ExitCycle Raise RaiseToUser Retry Return TryNext + syn match rapidException /\s\+Stop\s*[\\;]/me=e-1 + highlight default link rapidException Exception + " }}} Statements, keywords et al + + " Special keyword for move command {{{ + " uncategorized yet + syn keyword rapidMovement MovePnP + syn keyword rapidMovement EGMMoveC EGMMoveL EGMRunJoint EGMRunPose EGMStop + syn keyword rapidMovement IndAMove IndCMove IndDMove IndRMove + " common instructions + syn keyword rapidMovement MoveAbsJ MoveC MoveExtJ MoveJ MoveL + syn keyword rapidMovement MoveCAO MoveCDO MoveCGO MoveCSync MoveJAO MoveJDO MoveJGO MoveJSync MoveLAO MoveLDO MoveLGO MoveLSync + syn keyword rapidMovement SearchC SearchExtJ SearchL + syn keyword rapidMovement TriggC TriggJ TriggL TriggJIOs TriggLIOs + " Arc instructions + syn keyword rapidMovement ArcC ArcC1 ArcC2 ArcCEnd ArcC1End ArcC2End ArcCStart ArcC1Start ArcC2Start + syn keyword rapidMovement ArcL ArcL1 ArcL2 ArcLEnd ArcL1End ArcL2End ArcLStart ArcL1Start ArcL2Start ArcMoveExtJ + " Arc Weldguide and MultiPass instructions + syn keyword rapidMovement ArcRepL ArcAdaptLStart ArcAdaptL ArcAdaptC ArcAdaptLEnd ArcAdaptCEnd ArcCalcLStart ArcCalcL ArcCalcC ArcCalcLEnd ArcCalcCEnd ArcAdaptRepL + syn keyword rapidMovement Break + " Continuous Application Platform instructions + syn keyword rapidMovement CapC CapL CapLATrSetup CSSDeactMoveL ContactL + " Dispense instructions + syn keyword rapidMovement DispL DispC + " Nut instructions" + syn keyword rapidMovement NutL NutJ + syn keyword rapidMovement PathRecMoveBwd PathRecMoveFwd + " Paint instructions" + syn keyword rapidMovement PaintL PaintLSig PaintLDO PaintC + syn keyword rapidMovement StartMove StartMoveRetry StepBwdPath StopMove StopMoveReset + " Spot instructions + syn keyword rapidMovement SpotL SpotJ SpotML SpotMJ CalibL CalibJ MeasureWearL + " Homepos-Running instructions + syn keyword rapidMovement SMoveJ SMoveJDO SMoveJGO SMoveJSync SMoveL SMoveLDO SMoveLGO SMoveLSync SSearchL STriggJ STriggL + syn keyword rapidMovement HR_ContMove HR_MoveBack HR_MoveRoutine HR_MoveTo HR_MoveToHome SCSSDeactMoveL + " Discrete application platform instructions + syn keyword rapidMovement DaProcML DaProcMJ + " VW Konzernstandard VWKS_1.07.02 + syn keyword rapidMovement MoveABS MoveABS_FB MoveABS_FRG MoveABS_ROB + syn keyword rapidMovement MoveCIRC MoveCIRC_FB MoveCIRC_FRG MoveCIRC_ROB + syn keyword rapidMovement MoveLIN MoveLIN_FB MoveLIN_FRG MoveLIN_ROB + syn keyword rapidMovement MovePTP MovePTP_FB MovePTP_FRG MovePTP_ROB + syn keyword rapidMovement SearchCIRC SearchCIRC_M + syn keyword rapidMovement SearchLIN SearchLIN_M + syn keyword rapidMovement MoveABS_AO MoveABS_DO MoveABS_GO + syn keyword rapidMovement MoveCIRC_AO MoveCIRC_DO MoveCIRC_GO + syn keyword rapidMovement MoveLIN_AO MoveLIN_DO MoveLIN_GO + syn keyword rapidMovement KW_LoesenLIN + syn keyword rapidMovement SPZ_FraesenLIN SPZ_FraesenPTP SPZ_MessenLIN SPZ_MessenPTP SPZ_LIN SPZ_PTP + syn keyword rapidMovement BZ_LIN BZ_PTP + syn keyword rapidMovement KL_LIN KL_CIRC + syn keyword rapidMovement BP_LIN BP_PTP + syn keyword rapidMovement BU_CIRC BU_LIN + syn keyword rapidMovement CZ_LIN CZ_LIN_V CZ_PTP CZ_PTP_V + syn keyword rapidMovement FD_LIN FD_PTP + syn keyword rapidMovement KG_LIN KG_PTP + syn keyword rapidMovement DA_LIN + syn keyword rapidMovement LK_CIRC LK_LIN + syn keyword rapidMovement LL_CIRC LL_LIN + syn keyword rapidMovement LS_CIRC LS_LIN LS_LIN_F LS_PTP_F + syn keyword rapidMovement LW_CIRC LW_LIN + syn keyword rapidMovement LZ_LIN LZ_PTP LZ_ReinigenLIN LZ_ReinigenPTP + syn keyword rapidMovement MS_CIRC MS_LIN MS_ReinigenLIN MS_SearchLIN MS_PTP_CS MS_LIN_CS GBL_LIN GBL_PTP GBL_RefPointLIN + syn keyword rapidMovement NK_LIN + syn keyword rapidMovement NZ_LIN NZ_LIN_V NZ_PTP NZ_PTP_V + syn keyword rapidMovement PR_LIN PR_PTP + syn keyword rapidMovement RF_CIRC RF_LIN + syn keyword rapidMovement STP_FraesenLIN STP_FraesenPTP STP_LIN STP_PTP + syn keyword rapidMovement SM_LIN SM_PTP + syn keyword rapidMovement BUA_CIRC BUA_LIN BUA_MessenLIN BUA_MessenPTP + syn keyword rapidMovement KE_LIN + if g:rapidGroupName + highlight default link rapidMovement Movement + else + highlight default link rapidMovement Special + endif + " }}} special keyword for move command + + " Any name {{{ + syn match rapidNames /\v[[:upper:][:lower:]](\k|\.)*/ + " }}} Any name + + " Attempt to avoid false highlight of num in case of parameter name: + " TPWrite "goPosNo="\num:=GOutput(goPosNo); + " Must follow after rapidNames in this file + syn match rapidType /\c\v\s*\ze[^ :]/ + + " Structure value {{{ + " rapid structrure values. added to be able to conceal them + syn region rapidConcealableString matchgroup=rapidConcealableString start=/"/ skip=/""/ end=/"/ oneline keepend extend contained contains=rapidStringDoubleQuote,rapidEscapedBackSlash,rapidCharCode,rapidErrorSingleBackslash,rapidErrorStringTooLong,@Spell conceal + highlight default link rapidConcealableString String + syn region rapidStructVal matchgroup=rapidStructDelimiter start=/\[/ end=/\]/ contains=rapidStructVal,rapidBoolean,rapidDec,rapidHex,rapidOct,rapidBin,rapidFloat,rapidConcealableString,rapidDelimiter,rapidConstant,rapidErrNo,rapidIntNo,rapidOperator keepend extend conceal cchar=* + highlight default link rapidStructDelimiter Delimiter + " check edge cases like this one: + " LOCAL CONST listitem lstAuswService{18}:=[["","Service Position"],["","Bremsentest"],["","Referenzfahrt"],["","Manuelles Abfahren"],["","Justagestellung"],["","Transportposition"], + " ["","Spitze-Spitze Greifer 1, [RT]"],["","Spitze-Spitze Greifer 2, [FT]"],["","Spitze-Spitze Pruefspitze"],["","Werkobjekt Ablage"],["","Werkobjekt Modul 1"], + " ["","Werkobjekt Modul 2"],["","TCP von Greifer 1 vermessen, [RT]"],["","TCP von Greifer 2 vermessen, [FT]"],["","TCP von Basisdorn vermessen"], + " ["","Greifer abdocken"],["","Greifer andocken"],["","Kollision Check (Ohne Greifer)"]]; + " }}} Structure value + + " Delimiter {{{ + syn match rapidDelimiter /[\\(){},;|]/ + highlight default link rapidDelimiter Delimiter + " }}} Delimiter + + " BuildInFunction {{{ + " dispense functions + syn keyword rapidBuildInFunction contained GetSignal GetSignalDnum + " Integrated Vision Platform functions + syn keyword rapidBuildInFunction contained CamGetExposure CamGetLoadedJob CamGetName CamNumberOfResults + " Continuous Application Platform functions + syn keyword rapidBuildInFunction contained CapGetFailSigs + syn keyword rapidBuildInFunction contained Abs AbsDnum ACos ACosDnum AInput AOutput ArgName ASin ASinDnum ATan ATanDnum ATan2 ATan2Dnum + syn keyword rapidBuildInFunction contained BitAnd BitAndDnum BitCheck BitCheckDnum BitLSh BitLShDnum BitNeg BitNegDnum BitOr BitOrDnum BitRSh BitRShDnum BitXOr BitXOrDnum ByteToStr + syn keyword rapidBuildInFunction contained CalcJointT CalcRobT CalcRotAxFrameZ CalcRotAxisFrame CDate CJointT ClkRead CorrRead Cos CosDnum CPos CRobT CrossProd CSpeedOverride CTime CTool CWObj + syn keyword rapidBuildInFunction contained DecToHex DefAccFrame DefDFrame DefFrame Dim DInput Distance DnumToNum DnumToStr DotProd DOutput + syn keyword rapidBuildInFunction contained EGMGetState EulerZYX EventType ExecHandler ExecLevel Exp + syn keyword rapidBuildInFunction contained FileSize FileTime FileTimeDnum FSSize + syn keyword rapidBuildInFunction contained GetAxisDistance GetAxisMoveTime GetMaxNumberOfCyclicBool GetMecUnitName GetModalPayLoadMode GetMotorTorque GetNextCyclicBool GetNextMechUnit GetNextSym GetNumberOfCyclicBool GetServiceInfo GetSignalOrigin GetSysInfo GetTaskName GetTime GetTSPStatus GetUASUserName GInput GInputDnum GOutput GOutputDnum + syn keyword rapidBuildInFunction contained HexToDec + syn keyword rapidBuildInFunction contained IndInpos IndSpeed IOUnitState IsBrakeCheckActive IsCyclicBool IsFile IsLeadThrough IsMechUnitActive IsPers IsStopMoveAct IsStopStateEvent IsSyncMoveOn IsSysId IsVar + syn keyword rapidBuildInFunction contained Max MaxExtLinearSpeed MaxExtReorientSpeed MaxRobReorientSpeed MaxRobSpeed Min MirPos ModExist ModTime ModTimeDnum MotionPlannerNo + syn keyword rapidBuildInFunction contained NonMotionMode NOrient NumToDnum NumToStr + syn keyword rapidBuildInFunction contained Offs OpMode OrientZYX ORobT + syn keyword rapidBuildInFunction contained ParIdPosValid ParIdRobValid PathLengthGet PathLevel PathRecValidBwd PathRecValidFwd PFRestart PoseInv PoseMult PoseVect Pow PowDnum PPMovedInManMode Present ProgMemFree PrxGetMaxRecordpos + syn keyword rapidBuildInFunction contained RawBytesLen ReadBin ReadDir ReadMotor ReadNum ReadStr ReadStrBin ReadVar RelTool RemainingRetries RMQGetSlotName RobName RobOS Round RoundDnum RunMode + syn keyword rapidBuildInFunction contained SafetyControllerGetChecksum SafetyControllerGetOpModePinCode SafetyControllerGetSWVersion SafetyControllerGetUserChecksum Sin SinDnum SocketGetStatus SocketPeek Sqrt SqrtDnum STCalcForce STCalcTorque STIsCalib STIsClosed STIsIndGun STIsOpen StrDigCalc StrDigCmp StrFind StrLen StrMap StrMatch StrMemb StrOrder StrPart StrToByte StrToVal + syn keyword rapidBuildInFunction contained Tan TanDnum TaskRunMec TaskRunRob TasksInSync TaskIsActive TaskIsExecuting TestAndSet TestDI TestSignRead TextGet TextTabFreeToUse TextTabGet TriggDataValid Trunc TruncDnum Type + syn keyword rapidBuildInFunction contained UIAlphaEntry UIClientExist UIDnumEntry UIDnumTune UIListView UIMessageBox UINumEntry UINumTune + syn keyword rapidBuildInFunction contained ValidIO ValToStr Vectmagn + " Bulls Eye functions + syn keyword rapidBuildInFunction contained OffsToolXYZ OffsToolPolar + " Force Control functions + syn keyword rapidBuildInFunction contained FCGetForce FCGetProcessData FCIsForceMode FCLoadID + " Discrete application platform functions + syn keyword rapidBuildInFunction contained DaGetFstTimeEvt DaCheckMMSOpt DaGetMP DaGetRobotName DaGetTaskName + " Production Manager functions + syn keyword rapidBuildInFunction contained PMgrAtSafe PMgrAtService PMgrAtState PMgrAtStation PMgrNextStation PMgrTaskNumber PMgrTaskName + " Spot functions + syn keyword rapidBuildInFunction contained SwGetCurrTargetName SwGetCurrSpotName + " Homepos-Running functions + syn keyword rapidBuildInFunction contained HR_RobotInHome HR_GetTypeDIndex HR_GetTypeIndex + " Paint functions + syn keyword rapidBuildInFunction contained IndexLookup IpsCommand IpsGetParam PaintCommand PntQueueExtraGet PntQueueExtraSet PntQueuePeek + if g:rapidGroupName + highlight default link rapidBuildInFunction BuildInFunction + else + highlight default link rapidBuildInFunction Function + endif + " }}} + + " Function {{{ + syn match rapidFunction contains=rapidBuildInFunction /\v\c%(<%(PROC|MODULE)\s+)@1032 chars are not possible in rapid. a234567890123456789012345 + syn match rapidErrorIdentifierNameTooLong /\k\{33,}/ containedin=rapidFunction,rapidNames,rapidLabel + highlight default link rapidErrorIdentifierNameTooLong Error + " + " a == b + 1 + syn match rapidErrorShouldBeColonEqual /\c\v%(^\s*%(%(TASK\s+|LOCAL\s+)?%(VAR|PERS|CONST)\s+\k+\s+)?\k+%(\k|[.{},*/+-])*\s*)@<=\=/ + highlight default link rapidErrorShouldBeColonEqual Error + " + " WaitUntil a==b + syn match rapidErrorShouldBeEqual /\c\v%(^\s*%(Return|WaitUntil|while)>[^!\\]+[^!<>])@<=%(\=|:)\=/ + syn match rapidErrorShouldBeEqual /\c\v%(^\s*%(if|elseif)>[^!\\]+[^!<>])@<=%(\=|:)\=\ze[^!\\]+/ + highlight default link rapidErrorShouldBeEqual Error + " + " WaitUntil a=>b + syn match rapidErrorShoudBeLessOrGreaterEqual /\c\v%(^\s*%(Return|WaitUntil|if|elseif|while)>[^!]+[^!<>])@<=\=[><]/ + highlight default link rapidErrorShoudBeLessOrGreaterEqual Error + " + " WaitUntil a>\s*\ Date: Tue, 11 Jul 2023 22:38:29 +0200 Subject: [PATCH 021/163] patch 9.0.1682: sodium encryption is not portable Problem: crypt: sodium encryption is not portable Solution: use little-endian byte order for sodium encrypted files As mentioned in #12586, sodium encryption only works on little ending architectures, because reading and writing the sodium encryption parameters are stored in the encrypted files in an arch-dependent way. This of course fails for big-endian architectures like s390. So make sure to use little-endian byte order when reading and writing sodium encrypted files. fixes: #12586 closes: 12655 --- src/crypt.c | 103 ++++++++++++++++++++++++++++++++++++++++++-------- src/version.c | 2 + 2 files changed, 90 insertions(+), 15 deletions(-) diff --git a/src/crypt.c b/src/crypt.c index 9f0f68a2d4..d5d216b35f 100644 --- a/src/crypt.c +++ b/src/crypt.c @@ -77,6 +77,12 @@ typedef struct { static int crypt_sodium_init_(cryptstate_T *state, char_u *key, crypt_arg_T *arg); static long crypt_sodium_buffer_decode(cryptstate_T *state, char_u *from, size_t len, char_u **buf_out, int last); static long crypt_sodium_buffer_encode(cryptstate_T *state, char_u *from, size_t len, char_u **buf_out, int last); +# if defined(FEAT_SODIUM) || defined(PROTO) +static void crypt_long_long_to_char(long long n, char_u *s); +static void crypt_int_to_char(int n, char_u *s); +static long long crypt_char_to_long_long(char_u *s); +static int crypt_char_to_int(char_u *s); +#endif #if defined(FEAT_EVAL) && defined(FEAT_SODIUM) static void crypt_sodium_report_hash_params(unsigned long long opslimit, unsigned long long ops_def, size_t memlimit, size_t mem_def, int alg, int alg_def); #endif @@ -966,35 +972,45 @@ crypt_sodium_init_( // "cat_add" should not be NULL, check anyway for safety if (state->method_nr == CRYPT_M_SOD2 && arg->cat_add != NULL) { - memcpy(arg->cat_add, &opslimit, sizeof(opslimit)); - arg->cat_add += sizeof(opslimit); + char_u buffer[20]; + char_u *p = buffer; + vim_memset(buffer, 0, 20); - memcpy(arg->cat_add, &memlimit, sizeof(memlimit)); - arg->cat_add += sizeof(memlimit); + crypt_long_long_to_char(opslimit, p); + p += sizeof(opslimit); - memcpy(arg->cat_add, &alg, sizeof(alg)); - arg->cat_add += sizeof(alg); + crypt_long_long_to_char(memlimit, p); + p += sizeof(memlimit); + + crypt_int_to_char(alg, p); + memcpy(arg->cat_add, buffer, sizeof(opslimit) + sizeof(memlimit) + sizeof(alg)); } } else { + char_u buffer[20]; + char_u *p = buffer; + vim_memset(buffer, 0, 20); + int size = sizeof(opslimit) + + sizeof(memlimit) + sizeof(alg); + // Reading parameters from file - if (arg->cat_add_len - < (int)(sizeof(opslimit) + sizeof(memlimit) + sizeof(alg))) + if (arg->cat_add_len < size) { sodium_free(sd_state); return FAIL; } // derive the key from the file header - memcpy(&opslimit, arg->cat_add, sizeof(opslimit)); - arg->cat_add += sizeof(opslimit); + memcpy(p, arg->cat_add, size); + arg->cat_add += size; - memcpy(&memlimit, arg->cat_add, sizeof(memlimit)); - arg->cat_add += sizeof(memlimit); - - memcpy(&alg, arg->cat_add, sizeof(alg)); - arg->cat_add += sizeof(alg); + opslimit = crypt_char_to_long_long(p); + p += sizeof(opslimit); + memlimit = crypt_char_to_long_long(p); + p += sizeof(memlimit); + alg = crypt_char_to_int(p); + p += sizeof(alg); #ifdef FEAT_EVAL crypt_sodium_report_hash_params(opslimit, @@ -1327,6 +1343,63 @@ crypt_sodium_report_hash_params( } } #endif + + static void +crypt_long_long_to_char(long long n, char_u *s) +{ + int i; + for (i = 0; i < 8; i++) + { + s[i] = (char_u)(n & 0xff); + n = (unsigned)n >> 8; + } +} + + static void +crypt_int_to_char(int n, char_u *s) +{ + int i; + for (i = 0; i < 4; i++) + { + s[i] = (char_u)(n & 0xff); + n = (unsigned)n >> 8; + } +} + + static long long +crypt_char_to_long_long(char_u *s) +{ + unsigned long long retval = 0; + int i; + for (i = 7; i >= 0; i--) + { + if (i == 7) + retval = s[i]; + else + retval |= s[i]; + if (i > 0) + retval <<= 8; + } + return retval; +} + + static int +crypt_char_to_int(char_u *s) +{ + int retval = 0; + int i; + + for (i = 3; i >= 0; i--) + { + if (i == 3) + retval = s[i]; + else + retval |= s[i]; + if (i > 0) + retval <<= 8; + } + return retval; +} # endif #endif // FEAT_CRYPT diff --git a/src/version.c b/src/version.c index 39f637c185..6903b261d7 100644 --- a/src/version.c +++ b/src/version.c @@ -695,6 +695,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1682, /**/ 1681, /**/ From 6efb1980336ff324e9c57a4e282530b952fca816 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Thu, 10 Aug 2023 05:44:25 +0200 Subject: [PATCH 022/163] Updated runtime files This is a collection of various PRs from github that all require a minor patch number: 1) https://github.com/vim/vim/pull/12612 Do not conflate dictionary key with end of block 2) https://github.com/vim/vim/pull/12729: When saving and restoring 'undolevels', the constructs `&undolevels` and `:set undolevels` are problematic. The construct `&undolevels` reads an unpredictable value; it will be the local option value (if one has been set), or the global option value (otherwise), making it unsuitable for saving a value for later restoration. Similarly, if a local option value has been set for 'undolevels', temporarily modifying the option via `:set undolevels` changes the local value as well as the global value, requiring extra work to restore both values. Saving and restoring the option value in one step via the construct `:let &undolevels = &undolevels` appears to make no changes to the 'undolevels' option, but if a local option has been set to a different value than the global option, it has the unintended effect of changing the global 'undolevels' value to the local value. Update the documentation to explain these issues and recommend explicit use of global and local option values when saving and restoring. Update some unit tests to use `g:undolevels`. 3) https://github.com/vim/vim/pull/12702: Problem: Pip requirements files are not recognized. Solution: Add a pattern to match pip requirements files. 4) https://github.com/vim/vim/pull/12688: Add indent file and tests for ABB Rapid 5) https://github.com/vim/vim/pull/12668: Use Lua 5.1 numeric escapes in tests and add to CI Only Lua 5.2+ and LuaJIT understand hexadecimal escapes in strings. Lua 5.1 only supports decimal escapes: > A character in a string can also be specified by its numerical value > using the escape sequence \ddd, where ddd is a sequence of up to three > decimal digits. (Note that if a numerical escape is to be followed by a > digit, it must be expressed using exactly three digits.) Strings in Lua > can contain any 8-bit value, including embedded zeros, which can be > specified as '\0'. To make sure this works with Lua 5.4 and Lua 5.1 change the Vim CI to run with Lua 5.1 as well as Lua 5.4 6) https://github.com/vim/vim/pull/12631: Add hurl filetype detection 7) https://github.com/vim/vim/pull/12573: Problem: Files for haskell persistent library are not recognized Solution: Add pattern persistentmodels for haskell persistent library closes: #12612 closes: #12729 closes: #12702 closes: #12688 closes: #12668 closes: #12631 closes: #12573 Co-authored-by: lacygoill Co-authored-by: Michael Henry Co-authored-by: ObserverOfTime Co-authored-by: KnoP-01 Co-authored-by: James McCoy Co-authored-by: Jacob Pfeifer Co-authored-by: Borys Lykah --- .github/workflows/ci.yml | 10 +- runtime/autoload/dist/vimindent.vim | 20 +-- runtime/doc/undo.txt | 28 ++- runtime/filetype.vim | 8 + runtime/indent/rapid.vim | 255 ++++++++++++++++++++++++++ runtime/indent/testdir/rapid.in | 266 ++++++++++++++++++++++++++++ runtime/indent/testdir/rapid.ok | 266 ++++++++++++++++++++++++++++ runtime/indent/testdir/vim.in | 7 + runtime/indent/testdir/vim.ok | 7 + src/testdir/test_filetype.vim | 3 + src/testdir/test_lua.vim | 6 +- src/testdir/test_mapping.vim | 4 +- src/testdir/test_signs.vim | 4 +- src/version.c | 2 + 14 files changed, 860 insertions(+), 26 deletions(-) create mode 100644 runtime/indent/rapid.vim create mode 100644 runtime/indent/testdir/rapid.in create mode 100644 runtime/indent/testdir/rapid.ok diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 47c68ea7d7..104476b454 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,6 +38,7 @@ jobs: features: [tiny, normal, huge] compiler: [clang, gcc] extra: [none] + luaver: [lua5.4] include: - features: tiny compiler: clang @@ -54,13 +55,18 @@ jobs: coverage: true extra: testgui uchar: true + luaver: lua5.4 - features: huge compiler: clang extra: asan + # Lua5.1 is the most widely used version (since it's what LuaJIT is + # compatible with), so ensure it works + luaver: lua5.1 - features: huge compiler: gcc coverage: true extra: unittests + luaver: lua5.4 - features: normal compiler: gcc extra: vimtags @@ -85,8 +91,8 @@ jobs: libperl-dev \ python2-dev \ python3-dev \ - liblua5.4-dev \ - lua5.4 \ + lib${{ matrix.luaver }}-dev \ + ${{ matrix.luaver }} \ ruby-dev \ tcl-dev \ cscope \ diff --git a/runtime/autoload/dist/vimindent.vim b/runtime/autoload/dist/vimindent.vim index 1306d1e361..a5e04a5391 100644 --- a/runtime/autoload/dist/vimindent.vim +++ b/runtime/autoload/dist/vimindent.vim @@ -2,7 +2,7 @@ vim9script # Language: Vim script # Maintainer: github user lacygoill -# Last Change: 2023 Feb 01 +# Last Change: 2023 Jun 29 # NOTE: Whenever you change the code, make sure the tests are still passing: # @@ -112,10 +112,6 @@ const DICT_KEY: string = '^\s*\%(' .. '\)' .. ':\%(\s\|$\)' -# NOT_A_DICT_KEY {{{3 - -const NOT_A_DICT_KEY: string = ':\@!' - # END_OF_COMMAND {{{3 const END_OF_COMMAND: string = $'\s*\%($\|||\@!\|{INLINE_COMMENT}\)' @@ -197,13 +193,13 @@ patterns =<< trim eval END ldo\=\>!\= tabdo\=\> windo\> - au\%[tocmd]\>.* - com\%[mand]\>.* + au\%[tocmd]\>!\=.* + com\%[mand]\>!\=.* g\%[lobal]!\={PATTERN_DELIMITER}.* v\%[global]!\={PATTERN_DELIMITER}.* END -const HIGHER_ORDER_COMMAND: string = $'\%(^\|{BAR_SEPARATION}\)\s*\<\%({patterns->join('\|')}\){NOT_A_DICT_KEY}' +const HIGHER_ORDER_COMMAND: string = $'\%(^\|{BAR_SEPARATION}\)\s*\<\%({patterns->join('\|')}\)\%(\s\|$\)\@=' # START_MIDDLE_END {{{3 @@ -254,7 +250,7 @@ START_MIDDLE_END = START_MIDDLE_END kwds->map((_, kwd: string) => kwd == '' ? '' : $'\%(^\|{BAR_SEPARATION}\|\\%(\s*{OPERATOR}\)\@!')) + .. $'\<\%({kwd}\)\>\%(\s\|$\|!\)\@=\%(\s*{OPERATOR}\)\@!')) lockvar! START_MIDDLE_END @@ -279,7 +275,7 @@ patterns = BLOCKS const ENDS_BLOCK_OR_CLAUSE: string = '^\s*\%(' .. patterns->join('\|') .. $'\){END_OF_COMMAND}' .. $'\|^\s*cat\%[ch]\%(\s\+\({PATTERN_DELIMITER}\).*\1\)\={END_OF_COMMAND}' - .. $'\|^\s*elseif\=\>\%({OPERATOR}\)\@!' + .. $'\|^\s*elseif\=\>\%(\s\|$\)\@=\%(\s*{OPERATOR}\)\@!' # STARTS_NAMED_BLOCK {{{3 @@ -296,7 +292,7 @@ patterns = [] endfor } -const STARTS_NAMED_BLOCK: string = $'^\s*\%(sil\%[ent]\s\+\)\=\%({patterns->join('\|')}\)\>{NOT_A_DICT_KEY}' +const STARTS_NAMED_BLOCK: string = $'^\s*\%(sil\%[ent]\s\+\)\=\%({patterns->join('\|')}\)\>\%(\s\|$\|!\)\@=' # STARTS_CURLY_BLOCK {{{3 @@ -312,7 +308,7 @@ const STARTS_CURLY_BLOCK: string = '\%(' # STARTS_FUNCTION {{{3 -const STARTS_FUNCTION: string = $'^\s*\%({MODIFIERS.def}\)\=def\>{NOT_A_DICT_KEY}' +const STARTS_FUNCTION: string = $'^\s*\%({MODIFIERS.def}\)\=def\>!\=\s\@=' # ENDS_FUNCTION {{{3 diff --git a/runtime/doc/undo.txt b/runtime/doc/undo.txt index cc33482473..dc2274c14c 100644 --- a/runtime/doc/undo.txt +++ b/runtime/doc/undo.txt @@ -111,9 +111,19 @@ use CTRL-G u. This is useful if you want an insert command to be undoable in parts. E.g., for each sentence. |i_CTRL-G_u| Setting the value of 'undolevels' also closes the undo block. Even when the -new value is equal to the old value. In |Vim9| script: > - &undolevels = &undolevels +new value is equal to the old value. Use `g:undolevels` to explicitly read +and write only the global value of 'undolevels'. In |Vim9| script: > + &g:undolevels = &g:undolevels In legacy script: > + let &g:undolevels = &g:undolevels + +Note that the similar-looking assignment `let &undolevels=&undolevels` does not +preserve the global option value of 'undolevels' in the event that the local +option has been set to a different value. For example: > + " Start with different global and local values for 'undolevels'. + let &g:undolevels = 1000 + let &l:undolevels = 2000 + " This assignment changes the global option to 2000: let &undolevels = &undolevels ============================================================================== @@ -366,12 +376,20 @@ undo is possible. Use this if you are running out of memory. When you set 'undolevels' to -1 the undo information is not immediately cleared, this happens at the next change. To force clearing the undo information you can use these commands: > - :let old_undolevels = &undolevels - :set undolevels=-1 + :let old_undolevels = &l:undolevels + :setlocal undolevels=-1 :exe "normal a \\" - :let &undolevels = old_undolevels + :let &l:undolevels = old_undolevels :unlet old_undolevels +Note use of `&l:undolevels` to explicitly read the local value of 'undolevels' +and the use of `:setlocal` to change only the local option (which takes +precedence over the corresponding global option value). Saving the option value +via the use of `&undolevels` is unpredictable; it reads either the local value +(if one has been set) or the global value (otherwise). Also, if a local value +has been set, changing the option via `:set undolevels` will change both the +global and local values, requiring extra work to save and restore both values. + Marks for the buffer ('a to 'z) are also saved and restored, together with the text. diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 49e602fab1..eea55f8b99 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -894,6 +894,7 @@ if exists('$XDG_CONFIG_HOME') endif au BufNewFile,BufRead $HOME/.config/cabal/config setf cabalconfig au BufNewFile,BufRead cabal.config setf cabalconfig +au BufNewFile,BufRead *.persistentmodels setf haskellpersistent " Haste au BufNewFile,BufRead *.ht setf haste @@ -948,6 +949,9 @@ au BufNewFile,BufRead */etc/host.conf setf hostconf " Hosts access au BufNewFile,BufRead */etc/hosts.allow,*/etc/hosts.deny setf hostsaccess +" Hurl +au BufRead,BufNewFile *.hurl setf hurl + " Hyper Builder au BufNewFile,BufRead *.hb setf hb @@ -1564,6 +1568,10 @@ au BufNewFile,BufRead *.rcp setf pilrc " Pine config au BufNewFile,BufRead .pinerc,pinerc,.pinercex,pinercex setf pine +" Pip requirements +au BufNewFile,BufRead *.pip setf requirements +au BufNewFile,BufRead requirements.txt setf requirements + " Pipenv Pipfiles au BufNewFile,BufRead Pipfile setf toml au BufNewFile,BufRead Pipfile.lock setf json diff --git a/runtime/indent/rapid.vim b/runtime/indent/rapid.vim new file mode 100644 index 0000000000..f97ebf84db --- /dev/null +++ b/runtime/indent/rapid.vim @@ -0,0 +1,255 @@ +" ABB Rapid Command indent file for Vim +" Language: ABB Rapid Command +" Maintainer: Patrick Meiser-Knosowski +" Version: 2.2.7 +" Last Change: 12. May 2023 +" Credits: Based on indent/vim.vim +" +" Suggestions of improvement are very welcome. Please email me! +" +" Known bugs: ../doc/rapid.txt +" +" TODO +" * indent wrapped lines which do not end with an ; or special key word, +" maybe this is a better idea, but then () and [] has to be changed as +" well +" + +if exists("g:rapidNoSpaceIndent") + if !exists("g:rapidSpaceIndent") + let g:rapidSpaceIndent = !g:rapidNoSpaceIndent + endif + unlet g:rapidNoSpaceIndent +endif + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") || get(g:,'rapidNoIndent',0) + finish +endif +let b:did_indent = 1 + +setlocal nolisp +setlocal nosmartindent +setlocal autoindent +setlocal indentexpr=GetRapidIndent() +if get(g:,'rapidNewStyleIndent',0) + setlocal indentkeys=!^F,o,O,0=~endmodule,0=~error,0=~undo,0=~backward,0=~endproc,0=~endrecord,0=~endtrap,0=~endfunc,0=~else,0=~endif,0=~endtest,0=~endfor,0=~endwhile,:,<[>,<]>,<(>,<)> +else + setlocal indentkeys=!^F,o,O,0=~endmodule,0=~error,0=~undo,0=~backward,0=~endproc,0=~endrecord,0=~endtrap,0=~endfunc,0=~else,0=~endif,0=~endtest,0=~endfor,0=~endwhile,: +endif +let b:undo_indent="setlocal lisp< si< ai< inde< indk<" + +if get(g:,'rapidSpaceIndent',1) + " Use spaces for indention, 2 is enough. + " More or even tabs wastes space on the teach pendant. + setlocal softtabstop=2 + setlocal shiftwidth=2 + setlocal expandtab + setlocal shiftround + let b:undo_indent = b:undo_indent." sts< sw< et< sr<" +endif + +" Only define the function once. +if exists("*GetRapidIndent") + finish +endif + +let s:keepcpo= &cpo +set cpo&vim + +function GetRapidIndent() + let ignorecase_save = &ignorecase + try + let &ignorecase = 0 + return s:GetRapidIndentIntern() + finally + let &ignorecase = ignorecase_save + endtry +endfunction + +function s:GetRapidIndentIntern() abort + + let l:currentLineNum = v:lnum + let l:currentLine = getline(l:currentLineNum) + + if l:currentLine =~ '^!' && !get(g:,'rapidCommentIndent',0) + " If current line is ! line comment, do not change indent + " This may be usefull if code is commented out at the first column. + return 0 + endif + + " Find a non-blank line above the current line. + let l:preNoneBlankLineNum = s:RapidPreNoneBlank(v:lnum - 1) + if l:preNoneBlankLineNum == 0 + " At the start of the file use zero indent. + return 0 + endif + + let l:preNoneBlankLine = getline(l:preNoneBlankLineNum) + let l:ind = indent(l:preNoneBlankLineNum) + + " Define add a 'shiftwidth' pattern + let l:addShiftwidthPattern = '\c\v^\s*(' + let l:addShiftwidthPattern .= '((local|task)\s+)?(module|record|proc|func|trap)\s+\k' + let l:addShiftwidthPattern .= '|(backward|error|undo)>' + let l:addShiftwidthPattern .= ')' + " + " Define Subtract 'shiftwidth' pattern + let l:subtractShiftwidthPattern = '\c\v^\s*(' + let l:subtractShiftwidthPattern .= 'end(module|record|proc|func|trap)>' + let l:subtractShiftwidthPattern .= '|(backward|error|undo)>' + let l:subtractShiftwidthPattern .= ')' + + " Add shiftwidth + if l:preNoneBlankLine =~ l:addShiftwidthPattern + \|| s:RapidLenTilStr(l:preNoneBlankLineNum, "then", 0)>=0 + \|| s:RapidLenTilStr(l:preNoneBlankLineNum, "else", 0)>=0 + \|| s:RapidLenTilStr(l:preNoneBlankLineNum, "do", 0)>=0 + \|| s:RapidLenTilStr(l:preNoneBlankLineNum, "case", 0)>=0 + \|| s:RapidLenTilStr(l:preNoneBlankLineNum, "default", 0)>=0 + let l:ind += &sw + endif + + " Subtract shiftwidth + if l:currentLine =~ l:subtractShiftwidthPattern + \|| s:RapidLenTilStr(l:currentLineNum, "endif", 0)>=0 + \|| s:RapidLenTilStr(l:currentLineNum, "endfor", 0)>=0 + \|| s:RapidLenTilStr(l:currentLineNum, "endwhile", 0)>=0 + \|| s:RapidLenTilStr(l:currentLineNum, "endtest", 0)>=0 + \|| s:RapidLenTilStr(l:currentLineNum, "else", 0)>=0 + \|| s:RapidLenTilStr(l:currentLineNum, "elseif", 0)>=0 + \|| s:RapidLenTilStr(l:currentLineNum, "case", 0)>=0 + \|| s:RapidLenTilStr(l:currentLineNum, "default", 0)>=0 + let l:ind = l:ind - &sw + endif + + " First case (or default) after a test gets the indent of the test. + if (s:RapidLenTilStr(l:currentLineNum, "case", 0)>=0 || s:RapidLenTilStr(l:currentLineNum, "default", 0)>=0) && s:RapidLenTilStr(l:preNoneBlankLineNum, "test", 0)>=0 + let l:ind += &sw + endif + + " continued lines with () or [] + let l:OpenSum = s:RapidLoneParen(l:preNoneBlankLineNum,"(") + s:RapidLoneParen(l:preNoneBlankLineNum,"[") + if get(g:,'rapidNewStyleIndent',0) + let l:CloseSum = s:RapidLoneParen(l:preNoneBlankLineNum,")") + s:RapidLoneParen(l:currentLineNum,"]") + else + let l:CloseSum = s:RapidLoneParen(l:preNoneBlankLineNum,")") + s:RapidLoneParen(l:preNoneBlankLineNum,"]") + endif + if l:OpenSum > l:CloseSum + let l:ind += (l:OpenSum * 4 * &sw) + elseif l:OpenSum < l:CloseSum + let l:ind -= (l:CloseSum * 4 * &sw) + endif + + return l:ind +endfunction + +" Returns the length of the line until a:str occur outside a string or +" comment. Search starts at string index a:startIdx. +" If a:str is a word also add word bounderies and case insesitivity. +" Note: rapidTodoComment and rapidDebugComment are not taken into account. +function s:RapidLenTilStr(lnum, str, startIdx) abort + + let l:line = getline(a:lnum) + let l:len = strlen(l:line) + let l:idx = a:startIdx + let l:str = a:str + if l:str =~ '^\k\+$' + let l:str = '\c\<' . l:str . '\>' + endif + + while l:len > l:idx + let l:idx = match(l:line, l:str, l:idx) + if l:idx < 0 + " a:str not found + return -1 + endif + let l:synName = synIDattr(synID(a:lnum,l:idx+1,0),"name") + if l:synName != "rapidString" + \&& l:synName != "rapidConcealableString" + \&& (l:synName != "rapidComment" || l:str =~ '^!') + " a:str found outside string or line comment + return l:idx + endif + " a:str is part of string or line comment + let l:idx += 1 " continue search for a:str + endwhile + + " a:str not found or l:len <= a:startIdx + return -1 +endfunction + +" a:lchar shoud be one of (, ), [, ], { or } +" returns the number of opening/closing parenthesise which have no +" closing/opening match in getline(a:lnum) +function s:RapidLoneParen(lnum,lchar) abort + if a:lchar == "(" || a:lchar == ")" + let l:opnParChar = "(" + let l:clsParChar = ")" + elseif a:lchar == "[" || a:lchar == "]" + let l:opnParChar = "[" + let l:clsParChar = "]" + elseif a:lchar == "{" || a:lchar == "}" + let l:opnParChar = "{" + let l:clsParChar = "}" + else + return 0 + endif + + let l:line = getline(a:lnum) + + " look for the first ! which is not part of a string + let l:len = s:RapidLenTilStr(a:lnum,"!",0) + if l:len == 0 + return 0 " first char is !; ignored + endif + + let l:opnParen = 0 + " count opening brakets + let l:i = 0 + while l:i >= 0 + let l:i = s:RapidLenTilStr(a:lnum, l:opnParChar, l:i) + if l:i >= 0 + let l:opnParen += 1 + let l:i += 1 + endif + endwhile + + let l:clsParen = 0 + " count closing brakets + let l:i = 0 + while l:i >= 0 + let l:i = s:RapidLenTilStr(a:lnum, l:clsParChar, l:i) + if l:i >= 0 + let l:clsParen += 1 + let l:i += 1 + endif + endwhile + + if (a:lchar == "(" || a:lchar == "[" || a:lchar == "{") && l:opnParen>l:clsParen + return (l:opnParen-l:clsParen) + elseif (a:lchar == ")" || a:lchar == "]" || a:lchar == "}") && l:clsParen>l:opnParen + return (l:clsParen-l:opnParen) + endif + + return 0 +endfunction + +" This function works almost like prevnonblank() but handles %%%-headers and +" comments like blank lines +function s:RapidPreNoneBlank(lnum) abort + + let nPreNoneBlank = prevnonblank(a:lnum) + + while nPreNoneBlank>0 && getline(nPreNoneBlank) =~ '\v\c^\s*(\%\%\%|!)' + " Previouse none blank line irrelevant. Look further aback. + let nPreNoneBlank = prevnonblank(nPreNoneBlank - 1) + endwhile + + return nPreNoneBlank +endfunction + +let &cpo = s:keepcpo +unlet s:keepcpo + +" vim:sw=2 sts=2 et diff --git a/runtime/indent/testdir/rapid.in b/runtime/indent/testdir/rapid.in new file mode 100644 index 0000000000..515912ed89 --- /dev/null +++ b/runtime/indent/testdir/rapid.in @@ -0,0 +1,266 @@ +! vim: set ft=rapid : + +! START_INDENT + +%%% + VERSION:1 + LANGUAGE:ENGLISH +%%% + +module LowerCaseModule + +task pers num n1 := 0; +local pers num n2 := 1; +var bool b1 := false; +var intnum i1; + +! put some stuff in those strings that may confuse indentation +const string st1 := "endmodule ("; +pers string st_Appl_Info{3,3}:=[ +[ +"[" +, +"default" +, +"case" +], +[ +"else" +, +"then" +, +"endif" +], +[ +"do" +, +"}" +, +")" +], +]; + +pers tooldata tTool1:=[TRUE, +[ +[97.4, 0, 223.1], +[0.924, 0, 0.383 ,0] +], +[5, +[23, 0, 75], +[1, 0, 0, 0], 0, 0, 0 +] +]; +const robtarget p1:=[ +[600, 500, 225.3], +[1, 0, 0, 0], +[1, 1, 0, 0], +[ 11, 12.3, 9E9, 9E9, 9E9, 9E9] +]; + +record myRec +num nRecNum1 +bool bRecBool1 +endrecord + +proc proc1(num n1, +num n2) +var string st1; +n1 := n1+1; +MoveJSync p1, vmax, z30, tool1, "proc2"; +backward +MoveJSync p1, v100, fine, tool1, "proc2"; +undo +n1 := n1-1; +error +trynext; +endproc + +func num nFunc1( +switch s1 +|switch s2 +,num n1 +,bool b1) +var num nVar; +if not Present(s1) return; +if Present(s1) then +Incr n1;' +elseif Present(s2) then +b1:=false; +else +while n1>0 do +Decr n1; +test n1 + +case 1: +test1; +case 2: +test2; +default: +WaitUntil false; +endtest +endwhile +endif +for i from 1 to 10 step 2 do +for j from 1 to 10 do +st_Appl_Info{i,j} := ""; +endfor +endfor +! return 1; +return 0; +error +return -1; +endfunc + +trap Trap1 +Reset do1; +endtrap + +endmodule + +MODULE UpperCaseModule(SYSMODULE,NOSTEPIN) +TASK pers num n1 := 0; +LOCAL pers num n2 := 1; +VAR bool b1 := false; +VAR intnum i1; + +LOCAL FUNC num nFunc1( +switch s1 +|switch s2 +,num n1 +,bool b1) +VAR num nVar; +IF NOT PRESENT(s1) RETURN; +IF PRESENT(s1) THEN +INCR n1;' +ELSEIF PRESENT(s2) THEN +b1:=FALSE; +ELSE +WHILE n1>0 DO +DECR n1; +TEST n1 + +CASE 1: +test1; +CASE 2: +test2; +DEFAULT: +WAITUNTIL FALSE; +ENDTEST +ENDWHILE +ENDIF +FOR i FROM 1 TO 10 STEP 2 DO +FOR j FROM 1 TO 10 DO +st_Appl_Info{i,j} := ""; +ENDFOR +ENDFOR +! RETURN 1; +RETURN 0; +ERROR +RETURN -1; +ENDFUNC + +TRAP Trap1 +Reset do1; +ENDTRAP + +ENDMODULE + +Module MixedCaseModule(SysModule) +Task pers num n1 := 0; +Local pers num n2 := 1; +Var bool b1 := false; +Var intnum i1; + +Task Func num nFunc1( +switch s1 +|switch s2 +,num n1 +,bool b1) +Var num nVar; +If Not Present(s1) Return; +If Present(s1) Then +Incr n1;' +ElseIf Present(s2) Then +b1:=false; +Else +While n1>0 Do +Decr n1; +Test n1 + +Case 1: +test1; +Case 2: +test2; +Default: +WaitUntil false; +EndTest +EndWhile +EndIf +For i From 1 To 10 Step 2 Do +For j From 1 To 10 Do +st_Appl_Info{i,j} := ""; +EndFor +EndFor +! Return 1; +Return 0; +Error +Return -1; +EndFunc + +Trap Trap1 +Reset do1; +EndTrap + +EndModule + +! END_INDENT + +! START_INDENT +! INDENT_EXE let g:rapidSpaceIndent = 0 +! INDENT_EXE set shiftwidth=4 + +proc bla() +var num i; +Incr i; +endproc + +! END_INDENT + +! START_INDENT +! INDENT_EXE let g:rapidCommentIndent = 1 +! +proc bla() +! indent this first column comment because of g:rapidCommentIndent=1 +endproc +! END_INDENT + +! START_INDENT +! INDENT_EXE let g:rapidNewStyleIndent = 1 +pers string st_Appl_Info{3,3}:= +[ +[ +"[" +, +"default" +, +"case" +] +, +[ +"else" +, +"then" +, +"endif" +] +, +[ +"do" +, +"}" +, +")" +] +, +]; +! END_INDENT diff --git a/runtime/indent/testdir/rapid.ok b/runtime/indent/testdir/rapid.ok new file mode 100644 index 0000000000..ce336821c4 --- /dev/null +++ b/runtime/indent/testdir/rapid.ok @@ -0,0 +1,266 @@ +! vim: set ft=rapid : + +! START_INDENT + +%%% +VERSION:1 +LANGUAGE:ENGLISH +%%% + +module LowerCaseModule + + task pers num n1 := 0; + local pers num n2 := 1; + var bool b1 := false; + var intnum i1; + +! put some stuff in those strings that may confuse indentation + const string st1 := "endmodule ("; + pers string st_Appl_Info{3,3}:=[ + [ + "[" + , + "default" + , + "case" + ], + [ + "else" + , + "then" + , + "endif" + ], + [ + "do" + , + "}" + , + ")" + ], + ]; + + pers tooldata tTool1:=[TRUE, + [ + [97.4, 0, 223.1], + [0.924, 0, 0.383 ,0] + ], + [5, + [23, 0, 75], + [1, 0, 0, 0], 0, 0, 0 + ] + ]; + const robtarget p1:=[ + [600, 500, 225.3], + [1, 0, 0, 0], + [1, 1, 0, 0], + [ 11, 12.3, 9E9, 9E9, 9E9, 9E9] + ]; + + record myRec + num nRecNum1 + bool bRecBool1 + endrecord + + proc proc1(num n1, + num n2) + var string st1; + n1 := n1+1; + MoveJSync p1, vmax, z30, tool1, "proc2"; + backward + MoveJSync p1, v100, fine, tool1, "proc2"; + undo + n1 := n1-1; + error + trynext; + endproc + + func num nFunc1( + switch s1 + |switch s2 + ,num n1 + ,bool b1) + var num nVar; + if not Present(s1) return; + if Present(s1) then + Incr n1;' + elseif Present(s2) then + b1:=false; + else + while n1>0 do + Decr n1; + test n1 + + case 1: + test1; + case 2: + test2; + default: + WaitUntil false; + endtest + endwhile + endif + for i from 1 to 10 step 2 do + for j from 1 to 10 do + st_Appl_Info{i,j} := ""; + endfor + endfor +! return 1; + return 0; + error + return -1; + endfunc + + trap Trap1 + Reset do1; + endtrap + +endmodule + +MODULE UpperCaseModule(SYSMODULE,NOSTEPIN) + TASK pers num n1 := 0; + LOCAL pers num n2 := 1; + VAR bool b1 := false; + VAR intnum i1; + + LOCAL FUNC num nFunc1( + switch s1 + |switch s2 + ,num n1 + ,bool b1) + VAR num nVar; + IF NOT PRESENT(s1) RETURN; + IF PRESENT(s1) THEN + INCR n1;' + ELSEIF PRESENT(s2) THEN + b1:=FALSE; + ELSE + WHILE n1>0 DO + DECR n1; + TEST n1 + + CASE 1: + test1; + CASE 2: + test2; + DEFAULT: + WAITUNTIL FALSE; + ENDTEST + ENDWHILE + ENDIF + FOR i FROM 1 TO 10 STEP 2 DO + FOR j FROM 1 TO 10 DO + st_Appl_Info{i,j} := ""; + ENDFOR + ENDFOR +! RETURN 1; + RETURN 0; + ERROR + RETURN -1; + ENDFUNC + + TRAP Trap1 + Reset do1; + ENDTRAP + +ENDMODULE + +Module MixedCaseModule(SysModule) + Task pers num n1 := 0; + Local pers num n2 := 1; + Var bool b1 := false; + Var intnum i1; + + Task Func num nFunc1( + switch s1 + |switch s2 + ,num n1 + ,bool b1) + Var num nVar; + If Not Present(s1) Return; + If Present(s1) Then + Incr n1;' + ElseIf Present(s2) Then + b1:=false; + Else + While n1>0 Do + Decr n1; + Test n1 + + Case 1: + test1; + Case 2: + test2; + Default: + WaitUntil false; + EndTest + EndWhile + EndIf + For i From 1 To 10 Step 2 Do + For j From 1 To 10 Do + st_Appl_Info{i,j} := ""; + EndFor + EndFor +! Return 1; + Return 0; + Error + Return -1; + EndFunc + + Trap Trap1 + Reset do1; + EndTrap + +EndModule + +! END_INDENT + +! START_INDENT +! INDENT_EXE let g:rapidSpaceIndent = 0 +! INDENT_EXE set shiftwidth=4 + +proc bla() + var num i; + Incr i; +endproc + +! END_INDENT + +! START_INDENT +! INDENT_EXE let g:rapidCommentIndent = 1 +! +proc bla() + ! indent this first column comment because of g:rapidCommentIndent=1 +endproc +! END_INDENT + +! START_INDENT +! INDENT_EXE let g:rapidNewStyleIndent = 1 +pers string st_Appl_Info{3,3}:= +[ + [ + "[" + , + "default" + , + "case" + ] + , + [ + "else" + , + "then" + , + "endif" + ] + , + [ + "do" + , + "}" + , + ")" + ] + , +]; +! END_INDENT diff --git a/runtime/indent/testdir/vim.in b/runtime/indent/testdir/vim.in index c60d2d1160..c2e149ab37 100644 --- a/runtime/indent/testdir/vim.in +++ b/runtime/indent/testdir/vim.in @@ -483,6 +483,13 @@ endif endif " END_INDENT +" START_INDENT +if true +var d = { +end: 0} +endif +" END_INDENT + " START_INDENT nunmap ( nunmap ) diff --git a/runtime/indent/testdir/vim.ok b/runtime/indent/testdir/vim.ok index 57f0dbf34d..b10e081dd8 100644 --- a/runtime/indent/testdir/vim.ok +++ b/runtime/indent/testdir/vim.ok @@ -483,6 +483,13 @@ if true endif " END_INDENT +" START_INDENT +if true + var d = { + end: 0} +endif +" END_INDENT + " START_INDENT nunmap ( nunmap ) diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim index 25bfdeb004..e26d3a17ab 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -298,6 +298,7 @@ def s:GetFilenameChecks(): dict> handlebars: ['file.hbs'], hare: ['file.ha'], haskell: ['file.hs', 'file.hsc', 'file.hs-boot', 'file.hsig'], + haskellpersistent: ['file.persistentmodels'], haste: ['file.ht'], hastepreproc: ['file.htpp'], hb: ['file.hb'], @@ -316,6 +317,7 @@ def s:GetFilenameChecks(): dict> html: ['file.html', 'file.htm', 'file.cshtml'], htmlm4: ['file.html.m4'], httest: ['file.htt', 'file.htb'], + hurl: ['file.hurl'], i3config: ['/home/user/.i3/config', '/home/user/.config/i3/config', '/etc/i3/config', '/etc/xdg/i3/config'], ibasic: ['file.iba', 'file.ibi'], icemenu: ['/.icewm/menu', 'any/.icewm/menu'], @@ -564,6 +566,7 @@ def s:GetFilenameChecks(): dict> readline: ['.inputrc', 'inputrc'], rego: ['file.rego'], remind: ['.reminders', 'file.remind', 'file.rem', '.reminders-file'], + requirements: ['file.pip', 'requirements.txt'], rescript: ['file.res', 'file.resi'], resolv: ['resolv.conf'], reva: ['file.frt'], diff --git a/src/testdir/test_lua.vim b/src/testdir/test_lua.vim index 2f9e21fb62..81e9262ca2 100644 --- a/src/testdir/test_lua.vim +++ b/src/testdir/test_lua.vim @@ -616,10 +616,10 @@ endfunc func Test_lua_blob() call assert_equal(0z, luaeval('vim.blob("")')) call assert_equal(0z31326162, luaeval('vim.blob("12ab")')) - call assert_equal(0z00010203, luaeval('vim.blob("\x00\x01\x02\x03")')) - call assert_equal(0z8081FEFF, luaeval('vim.blob("\x80\x81\xfe\xff")')) + call assert_equal(0z00010203, luaeval('vim.blob("\000\001\002\003")')) + call assert_equal(0z8081FEFF, luaeval('vim.blob("\128\129\254\255")')) - lua b = vim.blob("\x00\x00\x00\x00") + lua b = vim.blob("\000\000\000\000") call assert_equal(0z00000000, luaeval('b')) call assert_equal(4, luaeval('#b')) lua b[0], b[1], b[2], b[3] = 1, 32, 256, 0xff diff --git a/src/testdir/test_mapping.vim b/src/testdir/test_mapping.vim index f9c21bb073..e81173d2bc 100644 --- a/src/testdir/test_mapping.vim +++ b/src/testdir/test_mapping.vim @@ -1341,13 +1341,13 @@ func Test_map_cmdkey_op_pending_mode() call assert_equal(['lines', 'of test text'], getline(1, '$')) call assert_equal(['some short '], getreg('"', 1, 1)) " create a new undo point - let &undolevels = &undolevels + let &g:undolevels = &g:undolevels call feedkeys(".", 'xt') call assert_equal(['test text'], getline(1, '$')) call assert_equal(['lines', 'of '], getreg('"', 1, 1)) " create a new undo point - let &undolevels = &undolevels + let &g:undolevels = &g:undolevels call feedkeys("uu", 'xt') call assert_equal(['some short lines', 'of test text'], getline(1, '$')) diff --git a/src/testdir/test_signs.vim b/src/testdir/test_signs.vim index 95e8d44869..ffde9b8739 100644 --- a/src/testdir/test_signs.vim +++ b/src/testdir/test_signs.vim @@ -1658,7 +1658,7 @@ func Test_sign_lnum_adjust() " Break the undo. Otherwise the undo operation below will undo all the " changes made by this function. - let &undolevels=&undolevels + let &g:undolevels=&g:undolevels " Delete the line with the sign call deletebufline('', 4) @@ -1671,7 +1671,7 @@ func Test_sign_lnum_adjust() call assert_equal(5, l[0].signs[0].lnum) " Break the undo - let &undolevels=&undolevels + let &g:undolevels=&g:undolevels " Delete few lines at the end of the buffer including the line with the sign " Sign line number should not change (as it is placed outside of the buffer) diff --git a/src/version.c b/src/version.c index 6903b261d7..34f1203cdf 100644 --- a/src/version.c +++ b/src/version.c @@ -695,6 +695,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1683, /**/ 1682, /**/ From 6a500661a9cb7b57093cf1095aa67e9c4aabc709 Mon Sep 17 00:00:00 2001 From: Dragan Simic' via vim_dev Date: Wed, 9 Aug 2023 17:23:57 +0200 Subject: [PATCH 023/163] Improve the vimscript code in ":h hex-editing" Save and restore the view position before and after saving the buffer, respectively, to keep the current view of the xxd(1)'s hex dump unchanged after doing ":w", which previously caused the window to scroll back to the very beginning of the buffer. I believe it's needless to say how annoying and counterproductive that was. Get rid of the "Press ENTER or type command to continue" message, which was previously displayed after opening larger binary files. The use of "silent" and "redraw" commands is tailored specifically to avoid screen flickering, e.g. when doing ":w", which is caused by the buffer being filtered by an external command. Increase the number of octets per line, produced by xxd(1), from the default value of 16 to 32. This puts bigger chunks of the hex dump on the screen and makes the whole thing much more usable. While there, reformat the code to make it more readable, and use the long form of the commands and variables to make the code slightly more consistent and more understandable to newcomers. --- runtime/doc/tips.txt | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/runtime/doc/tips.txt b/runtime/doc/tips.txt index ea8d538bf9..79b1574e22 100644 --- a/runtime/doc/tips.txt +++ b/runtime/doc/tips.txt @@ -431,14 +431,26 @@ comma-separated list of extension(s) you find yourself wanting to edit: > " vim -b : edit binary using xxd-format! augroup Binary - au! - au BufReadPre *.bin let &bin=1 - au BufReadPost *.bin if &bin | %!xxd - au BufReadPost *.bin set ft=xxd | endif - au BufWritePre *.bin if &bin | %!xxd -r - au BufWritePre *.bin endif - au BufWritePost *.bin if &bin | %!xxd - au BufWritePost *.bin set nomod | endif + autocmd! + autocmd BufReadPre *.bin set binary + autocmd BufReadPost *.bin + \ if &binary + \ | execute "silent %!xxd -c 32" + \ | set filetype=xxd + \ | redraw + \ | endif + autocmd BufWritePre *.bin + \ if &binary + \ | let s:view = winsaveview() + \ | execute "silent %!xxd -r -c 32" + \ | endif + autocmd BufWritePost *.bin + \ if &binary + \ | execute "silent %!xxd -c 32" + \ | set nomodified + \ | call winrestview(s:view) + \ | redraw + \ | endif augroup END ============================================================================== From 81b8bf5b4a33552c610dc2ea743ac2698a16aef7 Mon Sep 17 00:00:00 2001 From: Dragan Simic' via vim_dev Date: Wed, 9 Aug 2023 17:23:58 +0200 Subject: [PATCH 024/163] Update the vimscript code for restoring cursor position Using xxd(1) to filter and edit binary files causes the input files to have dual nature, so to speak, which effectively makes restoring the cursor position broken. Fix that by ignoring the "xxd" file type in the code that restores the cursor position. Interactive rebasing in git causes files to be edited in vim, which, similarly to commit messages, are rarely the same as the last one edited. Thus, also add "gitrebase" to the list of file types for which the cursor position isn't restored. While there, refactor the code a bit to possibly save a few CPU cycles and to keep the line lengths in check, and use the long form of the commands and variables, to make the code slightly more consistent and more understandable to newcomers. Update the relevant comments in the code and the associated parts of the documentation, to keep them in sync with the updated code. Remove some redundant trailing whitespace as well, as spotted. --- runtime/defaults.vim | 16 ++++++++++------ runtime/doc/usr_05.txt | 26 ++++++++++++++++++-------- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/runtime/defaults.vim b/runtime/defaults.vim index 67659895f2..6f8deb06ba 100644 --- a/runtime/defaults.vim +++ b/runtime/defaults.vim @@ -99,15 +99,19 @@ if 1 " Put these in an autocmd group, so that you can revert them with: " ":autocmd! vimStartup" augroup vimStartup - au! + autocmd! " When editing a file, always jump to the last known cursor position. " Don't do it when the position is invalid, when inside an event handler - " (happens when dropping a file on gvim) and for a commit message (it's - " likely a different one than last time). + " (happens when dropping a file on gvim), for a commit or rebase message + " (likely a different one than last time), and when using xxd(1) to filter + " and edit binary files (it transforms input files back and forth, causing + " them to have dual nature, so to speak) autocmd BufReadPost * - \ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit' - \ | exe "normal! g`\"" + \ let line = line("'\"") + \ | if line >= 1 && line <= line("$") && &filetype !~# 'commit' + \ && index(['xxd', 'gitrebase'], &filetype) == -1 + \ | execute "normal! g`\"" \ | endif augroup END @@ -119,7 +123,7 @@ if 1 augroup vimHints au! autocmd CmdwinEnter * - \ echohl Todo | + \ echohl Todo | \ echo gettext('You discovered the command-line window! You can close it with ":q".') | \ echohl None augroup END diff --git a/runtime/doc/usr_05.txt b/runtime/doc/usr_05.txt index bc68e61b88..f43b239564 100644 --- a/runtime/doc/usr_05.txt +++ b/runtime/doc/usr_05.txt @@ -308,17 +308,27 @@ This switches on three very clever mechanisms: *restore-cursor* *last-position-jump* > - autocmd BufReadPost * - \ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit' - \ | exe "normal! g`\"" - \ | endif + augroup RestoreCursor + autocmd! + autocmd BufReadPost * + \ let line = line("'\"") + \ | if line >= 1 && line <= line("$") && &filetype !~# 'commit' + \ && index(['xxd', 'gitrebase'], &filetype) == -1 + \ | execute "normal! g`\"" + \ | endif + augroup END Another autocommand. This time it is used after reading any file. The complicated stuff after it checks if the '" mark is defined, and jumps to it -if so. The backslash at the start of a line is used to continue the command -from the previous line. That avoids a line getting very long. -See |line-continuation|. This only works in a Vim script file, not when -typing commands at the command-line. +if so. It doesn't do that for a commit or rebase message, which are likely +a different one than last time, and when using xxd(1) to filter and edit +binary files, which transforms input files back and forth, causing them to +have dual nature, so to speak. See also |using-xxd|. + +The backslash at the start of a line is used to continue the command from the +previous line. That avoids a line getting very long. See |line-continuation|. +This only works in a Vim script file, not when typing commands at the +command line. > command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis From dd0ad2598898c2b4641c4acd5b70b6184fa698ed Mon Sep 17 00:00:00 2001 From: Hong Xu Date: Fri, 11 Aug 2023 10:29:20 -0700 Subject: [PATCH 025/163] Update syntax/dosini.vim to the latest version (#12764) The latest version is in https://github.com/xuhdev/syntax-dosini.vim/blob/master/syntax/dosini.vim. I've sent the file to Bram at the end of June, unfortunately it wasn't able to make into the Vim repository. RIP! --- runtime/syntax/dosini.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/runtime/syntax/dosini.vim b/runtime/syntax/dosini.vim index cf42819bcd..751a12f4b2 100644 --- a/runtime/syntax/dosini.vim +++ b/runtime/syntax/dosini.vim @@ -1,12 +1,12 @@ " Vim syntax file " Language: Configuration File (ini file) for MSDOS/MS Windows -" Version: 2.2 +" Version: 2.3 " Original Author: Sean M. McKee " Previous Maintainer: Nima Talebi " Current Maintainer: Hong Xu " Homepage: http://www.vim.org/scripts/script.php?script_id=3747 " Repository: https://github.com/xuhdev/syntax-dosini.vim -" Last Change: 2018 Sep 11 +" Last Change: 2023 Jun 27 " quit when a syntax file was already loaded @@ -24,6 +24,8 @@ syn match dosiniNumber "=\zs\s*\d*\.\d\+\s*$" syn match dosiniNumber "=\zs\s*\d\+e[+-]\=\d\+\s*$" syn region dosiniHeader start="^\s*\[" end="\]" syn match dosiniComment "^[#;].*$" +syn region dosiniSection start="\s*\[.*\]" end="\ze\s*\[.*\]" fold + \ contains=dosiniLabel,dosiniValue,dosiniNumber,dosiniHeader,dosiniComment " Define the default highlighting. " Only when an item doesn't have highlighting yet From 21aaff3faa828c5c2677a0a9f1b90a0b780d57f6 Mon Sep 17 00:00:00 2001 From: Lily Ballard Date: Fri, 11 Aug 2023 10:30:27 -0700 Subject: [PATCH 026/163] Update my name and email in runtime files (#12763) --- runtime/autoload/rust.vim | 2 +- runtime/doc/version7.txt | 2 +- runtime/ftplugin/rust.vim | 2 +- runtime/ftplugin/toml.vim | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/autoload/rust.vim b/runtime/autoload/rust.vim index 34a3b41773..4230332fa7 100644 --- a/runtime/autoload/rust.vim +++ b/runtime/autoload/rust.vim @@ -1,4 +1,4 @@ -" Author: Kevin Ballard +" Author: Lily Ballard " Description: Helper functions for Rust commands/mappings " Last Modified: May 27, 2014 " For bugs, patches and license go to https://github.com/rust-lang/rust.vim diff --git a/runtime/doc/version7.txt b/runtime/doc/version7.txt index c7248c2d27..7ca46c59a1 100644 --- a/runtime/doc/version7.txt +++ b/runtime/doc/version7.txt @@ -4627,7 +4627,7 @@ using an #ifdef. (Sergey Khorev) Mzscheme interface didn't link, missing function. Changed order of libraries in the configure script. -Ruby interface didn't compile on Mac. Changed #ifdef. (Kevin Ballard) +Ruby interface didn't compile on Mac. Changed #ifdef. (Lily Ballard) Patch 7.1b.001 (extra) Problem: Random text in a source file. No idea how it got there. diff --git a/runtime/ftplugin/rust.vim b/runtime/ftplugin/rust.vim index 7efca5985b..ececcced22 100644 --- a/runtime/ftplugin/rust.vim +++ b/runtime/ftplugin/rust.vim @@ -1,7 +1,7 @@ " Language: Rust " Description: Vim ftplugin for Rust " Maintainer: Chris Morgan -" Maintainer: Kevin Ballard +" Maintainer: Lily Ballard " Last Change: June 08, 2016 " For bugs, patches and license go to https://github.com/rust-lang/rust.vim diff --git a/runtime/ftplugin/toml.vim b/runtime/ftplugin/toml.vim index 1ef09a16e3..6bd79b1c0a 100644 --- a/runtime/ftplugin/toml.vim +++ b/runtime/ftplugin/toml.vim @@ -2,7 +2,7 @@ " Language: TOML " Homepage: https://github.com/cespare/vim-toml " Maintainer: Aman Verma -" Author: Kevin Ballard +" Author: Lily Ballard " Last Change: Sep 21, 2021 if exists('b:did_ftplugin') From 8f5a8d8a8bdc3ab952a0eddfae8a66852b698220 Mon Sep 17 00:00:00 2001 From: dkearns Date: Sat, 12 Aug 2023 03:30:55 +1000 Subject: [PATCH 027/163] Update CODEOWNERS (#12760) --- .github/CODEOWNERS | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index aeec2713f4..21d57a6c0a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -18,6 +18,7 @@ runtime/autoload/netrwFileHandlers.vim @cecamp runtime/autoload/netrwSettings.vim @cecamp runtime/autoload/php.vim @david-szabo97 runtime/autoload/rubycomplete.vim @segfault @dkearns +runtime/autoload/rust.vim @lilyball runtime/autoload/tar.vim @cecamp runtime/autoload/vimball.vim @cecamp runtime/autoload/xmlformat.vim @chrisbra @@ -150,7 +151,9 @@ runtime/ftplugin/go.vim @dbarnett runtime/ftplugin/gprof.vim @dpelle runtime/ftplugin/haml.vim @tpope runtime/ftplugin/hare.vim @rsaihe +runtime/ftplugin/heex.vim @cvincent runtime/ftplugin/hgcommit.vim @k-takata +runtime/ftplugin/hog.vim @wtfbbqhax runtime/ftplugin/html.vim @dkearns runtime/ftplugin/i3config.vim @hiqua runtime/ftplugin/icon.vim @dkearns @@ -180,6 +183,7 @@ runtime/ftplugin/pascal.vim @dkearns runtime/ftplugin/pbtxt.vim @lakshayg runtime/ftplugin/pdf.vim @tpope runtime/ftplugin/perl.vim @petdance @dkearns +runtime/ftplugin/php.vim @dkearns runtime/ftplugin/pod.vim @petdance @dkearns runtime/ftplugin/poefilter.vim @ObserverOfTime runtime/ftplugin/postscr.vim @mrdubya @@ -197,6 +201,7 @@ runtime/ftplugin/routeros.vim @zainin runtime/ftplugin/rrst.vim @jalvesaq runtime/ftplugin/rst.vim @marshallward runtime/ftplugin/ruby.vim @tpope @dkearns +runtime/ftplugin/rust.vim @lilyball runtime/ftplugin/sass.vim @tpope runtime/ftplugin/scala.vim @derekwyatt runtime/ftplugin/scss.vim @tpope @@ -215,6 +220,7 @@ runtime/ftplugin/toml.vim @averms runtime/ftplugin/tt2html.vim @petdance runtime/ftplugin/typescript.vim @dkearns runtime/ftplugin/typescriptreact.vim @dkearns +runtime/ftplugin/unison.vim @chuwy runtime/ftplugin/vdf.vim @ObserverOfTime runtime/ftplugin/wast.vim @rhysd runtime/ftplugin/wget.vim @dkearns @@ -251,6 +257,7 @@ runtime/indent/go.vim @dbarnett runtime/indent/gyp.vim @ObserverOfTime runtime/indent/haml.vim @tpope runtime/indent/hare.vim @rsaihe +runtime/indent/hog.vim @wtfbbqhax runtime/indent/idlang.vim @dkearns runtime/indent/j.vim @glts runtime/indent/java.vim @xuhdev @@ -258,6 +265,7 @@ runtime/indent/javascript.vim @bounceme runtime/indent/json.vim @elzr runtime/indent/jsonc.vim @izhakjakov runtime/indent/julia.vim @carlobaldassi +runtime/indent/krl.vim @KnoP-01 runtime/indent/ld.vim @dkearns runtime/indent/less.vim @genoma runtime/indent/liquid.vim @tpope @@ -276,6 +284,7 @@ runtime/indent/ps1.vim @heaths runtime/indent/qb64.vim @dkearns runtime/indent/r.vim @jalvesaq runtime/indent/racket.vim @benknoble +runtime/indent/rapid.vim @KnoP-01 runtime/indent/readline.vim @dkearns runtime/indent/rhelp.vim @jalvesaq runtime/indent/rmd.vim @jalvesaq @@ -377,6 +386,7 @@ runtime/syntax/hare.vim @rsaihe runtime/syntax/haskell.vim @coot runtime/syntax/hgcommit.vim @k-takata runtime/syntax/hitest.vim @lacygoill +runtime/syntax/hog.vim @wtfbbqhax runtime/syntax/hollywood.vim @sodero runtime/syntax/html.vim @dkearns runtime/syntax/i3config.vim @hiqua @@ -389,6 +399,7 @@ runtime/syntax/javascript.vim @fleiner runtime/syntax/jsonc.vim @izhakjakov runtime/syntax/julia.vim @carlobaldassi runtime/syntax/kconfig.vim @chrisbra +runtime/syntax/krl.vim @KnoP-01 runtime/syntax/less.vim @genoma runtime/syntax/lex.vim @cecamp runtime/syntax/liquid.vim @tpope @@ -432,6 +443,7 @@ runtime/syntax/qb64.vim @dkearns runtime/syntax/r.vim @jalvesaq runtime/syntax/racket.vim @benknoble runtime/syntax/raml.vim @in3d +runtime/syntax/rapid.vim @KnoP-01 runtime/syntax/ratpoison.vim @trapd00r runtime/syntax/rc.vim @chrisbra runtime/syntax/rcs.vim @hdima @@ -477,6 +489,7 @@ runtime/syntax/tt2js.vim @petdance runtime/syntax/typescript.vim @HerringtonDarkholme runtime/syntax/typescriptcommon.vim @HerringtonDarkholme runtime/syntax/typescriptreact.vim @HerringtonDarkholme +runtime/syntax/unison.vim @chuwy runtime/syntax/vdf.vim @ObserverOfTime runtime/syntax/vim.vim @cecamp runtime/syntax/vroom.vim @dbarnett From b00df7aa388994119346a21d77b0d0db2a0a5e9f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 8 Aug 2023 11:03:00 +0800 Subject: [PATCH 028/163] patch 9.0.1684: Update libvterm to rev 839 Problem: libvterm slightly outdated Solution: Update libvterm from rev 818 to rev 839 Notable fix: libvterm now handles DECSM/DECRM with multiple arguents, so several ncurses programs (e.g. nnn) can enable mouse properly when run in Vim's terminal in XTerm. closes: #12746 Signed-off-by: Christian Brabandt Co-authored-by: zeertzjq --- src/libvterm/CODE-MAP | 66 +++++++++++++++++++++++++++ src/libvterm/Makefile | 5 +- src/libvterm/include/vterm.h | 13 ++++++ src/libvterm/src/parser.c | 9 ++++ src/libvterm/src/pen.c | 18 ++++---- src/libvterm/src/screen.c | 53 +++++++++++++++++++-- src/libvterm/src/state.c | 56 ++++++++++++++++++----- src/libvterm/src/vterm.c | 3 ++ src/libvterm/src/vterm_internal.h | 3 ++ src/libvterm/t/17state_mouse.test | 10 ++++ src/libvterm/t/25state_input.test | 2 + src/libvterm/t/30state_pen.test | 8 ++++ src/libvterm/t/40state_selection.test | 24 ++++++++++ src/libvterm/t/64screen_pen.test | 26 +++++++---- src/libvterm/t/69screen_reflow.test | 9 ++++ src/libvterm/t/harness.c | 42 ++++++++++++++++- src/version.c | 2 + 17 files changed, 312 insertions(+), 37 deletions(-) create mode 100644 src/libvterm/CODE-MAP diff --git a/src/libvterm/CODE-MAP b/src/libvterm/CODE-MAP new file mode 100644 index 0000000000..c7a0344fc8 --- /dev/null +++ b/src/libvterm/CODE-MAP @@ -0,0 +1,66 @@ +CODE-MAP + - high-level list and description of files in the repository + +CONTRIBUTING + - documentation explaining how developers can contribute fixes and features + +doc/ + - contains documentation + +doc/seqs.txt + - documents the sequences recognised by the library + +include/vterm.h + - main include file + +include/vterm_keycodes.h + - include file containing the keyboard input keycode enumerations + +LICENSE + - legalese + +Makefile + - main build file + +src/ + - contains the source code for the library + +src/encoding.c + - handles mapping ISO/IEC 2022 alternate character sets into Unicode + codepoints + +src/keyboard.c + - handles sending reported keyboard events to the output stream + +src/mouse.c + - handles sending reported mouse events to the output stream + +src/parser.c + - parses bytes from the input stream into parser-level events + +src/pen.c + - interprets SGR sequences and maintains current rendering attributes + +src/screen.c + - uses state-level events to maintain a buffer of current screen contents + +src/state.c + - follows parser-level events to keep track of the overall terminal state + +src/unicode.c + - utility functions for Unicode and UTF-8 handling + +src/vterm.c + - toplevel object state and miscellaneous functions + +src/vterm_internal.h + - include file for definitions private to the library's internals + +t/ + - contains unit tests + +t/harness.c + - standalone program to embed the library into for unit-test purposes + +t/run-test.pl + - invokes the test harness to run a single unit test script diff --git a/src/libvterm/Makefile b/src/libvterm/Makefile index ba4a3157ed..94ca40998a 100644 --- a/src/libvterm/Makefile +++ b/src/libvterm/Makefile @@ -36,14 +36,11 @@ INCFILES=$(TBLFILES:.tbl=.inc) HFILES_INT=$(sort $(wildcard src/*.h)) $(HFILES) -VERSION_MAJOR=0 -VERSION_MINOR=3 - VERSION_CURRENT=0 VERSION_REVISION=0 VERSION_AGE=0 -VERSION=$(VERSION_MAJOR).$(VERSION_MINOR) +VERSION=0.3.3 PREFIX=/usr/local BINDIR=$(PREFIX)/bin diff --git a/src/libvterm/include/vterm.h b/src/libvterm/include/vterm.h index 6a967dbdb4..a3aa17a8f6 100644 --- a/src/libvterm/include/vterm.h +++ b/src/libvterm/include/vterm.h @@ -23,6 +23,7 @@ typedef unsigned int uint32_t; #define VTERM_VERSION_MAJOR 0 #define VTERM_VERSION_MINOR 3 +#define VTERM_VERSION_PATCH 3 #define VTERM_CHECK_VERSION \ vterm_check_version(VTERM_VERSION_MAJOR, VTERM_VERSION_MINOR) @@ -255,6 +256,7 @@ typedef enum { VTERM_PROP_REVERSE, // bool VTERM_PROP_CURSORSHAPE, // number VTERM_PROP_MOUSE, // number + VTERM_PROP_FOCUSREPORT, // bool VTERM_PROP_CURSORCOLOR, // VIM - string VTERM_N_PROPS @@ -422,6 +424,11 @@ typedef struct { void vterm_parser_set_callbacks(VTerm *vt, const VTermParserCallbacks *callbacks, void *user); void *vterm_parser_get_cbdata(VTerm *vt); +/* Normally NUL, CAN, SUB and DEL are ignored. Setting this true causes them + * to be emitted by the 'control' callback + */ +void vterm_parser_set_emit_nul(VTerm *vt, int emit); + // ----------- // State layer // ----------- @@ -645,6 +652,12 @@ int vterm_screen_is_eol(const VTermScreen *screen, VTermPos pos); */ void vterm_screen_convert_color_to_rgb(const VTermScreen *screen, VTermColor *col); +/** + * Similar to vterm_state_set_default_colors(), but also resets colours in the + * screen buffer(s) + */ +void vterm_screen_set_default_colors(VTermScreen *screen, const VTermColor *default_fg, const VTermColor *default_bg); + // --------- // Utilities // --------- diff --git a/src/libvterm/src/parser.c b/src/libvterm/src/parser.c index 0d1e12b0a2..6d225166e3 100644 --- a/src/libvterm/src/parser.c +++ b/src/libvterm/src/parser.c @@ -148,11 +148,15 @@ size_t vterm_input_write(VTerm *vt, const char *bytes, size_t len) string_fragment(vt, string_start, bytes + pos - string_start, FALSE); string_start = bytes + pos + 1; } + if(vt->parser.emit_nul) + do_control(vt, c); continue; } if(c == 0x18 || c == 0x1a) { // CAN, SUB vt->parser.in_esc = FALSE; ENTER_NORMAL_STATE(); + if(vt->parser.emit_nul) + do_control(vt, c); continue; } else if(c == 0x1b) { // ESC @@ -402,3 +406,8 @@ void *vterm_parser_get_cbdata(VTerm *vt) { return vt->parser.cbdata; } + +void vterm_parser_set_emit_nul(VTerm *vt, int emit) +{ + vt->parser.emit_nul = emit; +} diff --git a/src/libvterm/src/pen.c b/src/libvterm/src/pen.c index 1c6cd4e488..ddc8e40a79 100644 --- a/src/libvterm/src/pen.c +++ b/src/libvterm/src/pen.c @@ -259,15 +259,17 @@ void vterm_state_get_palette_color(const VTermState *state, int index, VTermColo void vterm_state_set_default_colors(VTermState *state, const VTermColor *default_fg, const VTermColor *default_bg) { - /* Copy the given colors */ - state->default_fg = *default_fg; - state->default_bg = *default_bg; + if(default_fg) { + state->default_fg = *default_fg; + state->default_fg.type = (state->default_fg.type & ~VTERM_COLOR_DEFAULT_MASK) + | VTERM_COLOR_DEFAULT_FG; + } - /* Make sure the correct type flags are set */ - state->default_fg.type = (state->default_fg.type & ~VTERM_COLOR_DEFAULT_MASK) - | VTERM_COLOR_DEFAULT_FG; - state->default_bg.type = (state->default_bg.type & ~VTERM_COLOR_DEFAULT_MASK) - | VTERM_COLOR_DEFAULT_BG; + if(default_bg) { + state->default_bg = *default_bg; + state->default_bg.type = (state->default_bg.type & ~VTERM_COLOR_DEFAULT_MASK) + | VTERM_COLOR_DEFAULT_BG; + } } void vterm_state_set_palette_color(VTermState *state, int index, const VTermColor *col) diff --git a/src/libvterm/src/screen.c b/src/libvterm/src/screen.c index fb1d26e432..53564be16b 100644 --- a/src/libvterm/src/screen.c +++ b/src/libvterm/src/screen.c @@ -292,7 +292,11 @@ static int erase_internal(VTermRect rect, int selective, void *user) continue; cell->chars[0] = 0; - cell->pen = screen->pen; + cell->pen = (ScreenPen){ + /* Only copy .fg and .bg; leave things like rv in reset state */ + .fg = screen->pen.fg, + .bg = screen->pen.bg, + }; cell->pen.dwl = info->doublewidth; cell->pen.dhl = info->doubleheight; } @@ -603,8 +607,15 @@ static void resize_buffer(VTermScreen *screen, int bufidx, int new_rows, int new new_row_start, new_row_end, old_row_start, old_row_end, width); #endif - if(new_row_start < 0) + if(new_row_start < 0) { + if(old_row_start <= old_cursor.row && old_cursor.row < old_row_end) { + new_cursor.row = 0; + new_cursor.col = old_cursor.col; + if(new_cursor.col >= new_cols) + new_cursor.col = new_cols-1; + } break; + } for(new_row = new_row_start, old_row = old_row_start; new_row <= new_row_end; new_row++) { int count = width >= new_cols ? new_cols : width; @@ -674,8 +685,9 @@ static void resize_buffer(VTermScreen *screen, int bufidx, int new_rows, int new if(old_row >= 0 && bufidx == BUFIDX_PRIMARY) { /* Push spare lines to scrollback buffer */ - for(int row = 0; row <= old_row; row++) - sb_pushline_from_row(screen, row); + if(screen->callbacks && screen->callbacks->sb_pushline) + for(int row = 0; row <= old_row; row++) + sb_pushline_from_row(screen, row); if(active) statefields->pos.row -= (old_row + 1); } @@ -1204,3 +1216,36 @@ void vterm_screen_convert_color_to_rgb(const VTermScreen *screen, VTermColor *co { vterm_state_convert_color_to_rgb(screen->state, col); } + +static void reset_default_colours(VTermScreen *screen, ScreenCell *buffer) +{ + for(int row = 0; row <= screen->rows - 1; row++) + for(int col = 0; col <= screen->cols - 1; col++) { + ScreenCell *cell = &buffer[row * screen->cols + col]; + if(VTERM_COLOR_IS_DEFAULT_FG(&cell->pen.fg)) + cell->pen.fg = screen->pen.fg; + if(VTERM_COLOR_IS_DEFAULT_BG(&cell->pen.bg)) + cell->pen.bg = screen->pen.bg; + } +} + +void vterm_screen_set_default_colors(VTermScreen *screen, const VTermColor *default_fg, const VTermColor *default_bg) +{ + vterm_state_set_default_colors(screen->state, default_fg, default_bg); + + if(default_fg && VTERM_COLOR_IS_DEFAULT_FG(&screen->pen.fg)) { + screen->pen.fg = *default_fg; + screen->pen.fg.type = (screen->pen.fg.type & ~VTERM_COLOR_DEFAULT_MASK) + | VTERM_COLOR_DEFAULT_FG; + } + + if(default_bg && VTERM_COLOR_IS_DEFAULT_BG(&screen->pen.bg)) { + screen->pen.bg = *default_bg; + screen->pen.bg.type = (screen->pen.bg.type & ~VTERM_COLOR_DEFAULT_MASK) + | VTERM_COLOR_DEFAULT_BG; + } + + reset_default_colours(screen, screen->buffers[0]); + if(screen->buffers[1]) + reset_default_colours(screen, screen->buffers[1]); +} diff --git a/src/libvterm/src/state.c b/src/libvterm/src/state.c index ee44824696..ee36ad4c2d 100644 --- a/src/libvterm/src/state.c +++ b/src/libvterm/src/state.c @@ -837,6 +837,7 @@ static void set_dec_mode(VTermState *state, int num, int val) break; case 1004: + settermprop_bool(state, VTERM_PROP_FOCUSREPORT, val); state->mode.report_focus = val; break; @@ -993,6 +994,7 @@ static int on_csi(const char *leader, const long args[], int argcount, const cha switch(intermed[0]) { case ' ': + case '!': case '"': case '$': case '\'': @@ -1370,8 +1372,10 @@ static int on_csi(const char *leader, const long args[], int argcount, const cha break; case LEADER('?', 0x68): // DEC private mode set - if(!CSI_ARG_IS_MISSING(args[0])) - set_dec_mode(state, CSI_ARG(args[0]), 1); + for(int i = 0; i < argcount; i++) { + if(!CSI_ARG_IS_MISSING(args[i])) + set_dec_mode(state, CSI_ARG(args[i]), 1); + } break; case 0x6a: // HPB - ECMA-48 8.3.58 @@ -1392,8 +1396,10 @@ static int on_csi(const char *leader, const long args[], int argcount, const cha break; case LEADER('?', 0x6c): // DEC private mode reset - if(!CSI_ARG_IS_MISSING(args[0])) - set_dec_mode(state, CSI_ARG(args[0]), 0); + for(int i = 0; i < argcount; i++) { + if(!CSI_ARG_IS_MISSING(args[i])) + set_dec_mode(state, CSI_ARG(args[i]), 0); + } break; case 0x6d: // SGR - ECMA-48 8.3.117 @@ -1486,7 +1492,7 @@ static int on_csi(const char *leader, const long args[], int argcount, const cha break; - case LEADER('!', 0x70): // DECSTR - DEC soft terminal reset + case INTERMED('!', 0x70): // DECSTR - DEC soft terminal reset vterm_state_reset(state, 0); break; @@ -1769,8 +1775,18 @@ static void osc_selection(VTermState *state, VTermStringFragment frag) frag.len--; } - if(!frag.len) + if(!frag.len) { + /* Clear selection if we're already finished but didn't do anything */ + if(frag.final && state->selection.callbacks->set) { + (*state->selection.callbacks->set)(state->tmp.selection.mask, (VTermStringFragment){ + .str = NULL, + .len = 0, + .initial = state->tmp.selection.state != SELECTION_SET, + .final = TRUE, + }, state->selection.user); + } return; + } if(state->tmp.selection.state == SELECTION_SELECTED) { if(frag.str[0] == '?') { @@ -1788,6 +1804,9 @@ static void osc_selection(VTermState *state, VTermStringFragment frag) return; } + if(state->tmp.selection.state == SELECTION_INVALID) + return; + if(state->selection.callbacks->set) { size_t bufcur = 0; char *buffer = state->selection.buffer; @@ -1823,11 +1842,21 @@ static void osc_selection(VTermState *state, VTermStringFragment frag) uint8_t b = unbase64one(frag.str[0]); if(b == 0xFF) { DEBUG_LOG1("base64decode bad input %02X\n", (uint8_t)frag.str[0]); + + state->tmp.selection.state = SELECTION_INVALID; + if(state->selection.callbacks->set) { + (*state->selection.callbacks->set)(state->tmp.selection.mask, (VTermStringFragment){ + .str = NULL, + .len = 0, + .initial = TRUE, + .final = TRUE, + }, state->selection.user); + } + break; } - else { - x = (x << 6) | b; - n++; - } + + x = (x << 6) | b; + n++; frag.str++, frag.len--; if(n == 4) { @@ -1847,7 +1876,7 @@ static void osc_selection(VTermState *state, VTermStringFragment frag) state->selection.buffer, // str bufcur, // len state->tmp.selection.state == SELECTION_SET_INITIAL, // initial - frag.final // final + frag.final && !frag.len // final }; (*state->selection.callbacks->set)(state->tmp.selection.mask, setfrag, state->selection.user); @@ -2004,7 +2033,7 @@ static void request_status_string(VTermState *state, VTermStringFragment frag) return; } - vterm_push_output_sprintf_str(state->vt, C1_DCS, TRUE, "0$r%s", tmp); + vterm_push_output_sprintf_str(state->vt, C1_DCS, TRUE, "0$r"); } static int on_dcs(const char *command, size_t commandlen, VTermStringFragment frag, void *user) @@ -2354,6 +2383,9 @@ int vterm_state_set_termprop(VTermState *state, VTermProp prop, VTermValue *val) if(val->number == VTERM_PROP_MOUSE_MOVE) state->mouse_flags |= MOUSE_WANT_MOVE; return 1; + case VTERM_PROP_FOCUSREPORT: + state->mode.report_focus = val->boolean; + return 1; case VTERM_N_PROPS: return 0; diff --git a/src/libvterm/src/vterm.c b/src/libvterm/src/vterm.c index ed6d21b778..dba6377186 100644 --- a/src/libvterm/src/vterm.c +++ b/src/libvterm/src/vterm.c @@ -73,6 +73,8 @@ VTerm *vterm_build(const struct VTermBuilder *builder) vt->parser.callbacks = NULL; vt->parser.cbdata = NULL; + vt->parser.emit_nul = FALSE; + vt->outfunc = NULL; vt->outdata = NULL; @@ -314,6 +316,7 @@ VTermValueType vterm_get_prop_type(VTermProp prop) case VTERM_PROP_REVERSE: return VTERM_VALUETYPE_BOOL; case VTERM_PROP_CURSORSHAPE: return VTERM_VALUETYPE_INT; case VTERM_PROP_MOUSE: return VTERM_VALUETYPE_INT; + case VTERM_PROP_FOCUSREPORT: return VTERM_VALUETYPE_BOOL; case VTERM_PROP_CURSORCOLOR: return VTERM_VALUETYPE_STRING; case VTERM_N_PROPS: return 0; diff --git a/src/libvterm/src/vterm_internal.h b/src/libvterm/src/vterm_internal.h index 3e95611b42..0f80fa4315 100644 --- a/src/libvterm/src/vterm_internal.h +++ b/src/libvterm/src/vterm_internal.h @@ -169,6 +169,7 @@ struct VTermState SELECTION_QUERY, SELECTION_SET_INITIAL, SELECTION_SET, + SELECTION_INVALID, } state : 8; uint32_t recvpartial; uint32_t sendpartial; @@ -238,6 +239,8 @@ struct VTerm void *cbdata; int string_initial; + + int emit_nul; } parser; /* len == malloc()ed size; cur == number of valid bytes */ diff --git a/src/libvterm/t/17state_mouse.test b/src/libvterm/t/17state_mouse.test index e5ba29b4e7..33b7dc2c74 100644 --- a/src/libvterm/t/17state_mouse.test +++ b/src/libvterm/t/17state_mouse.test @@ -55,6 +55,10 @@ MOUSEBTN d 4 0 output "\e[M\x60\x36\x2b" MOUSEBTN d 5 0 output "\e[M\x61\x36\x2b" +MOUSEBTN d 6 0 + output "\e[M\x62\x36\x2b" +MOUSEBTN d 7 0 + output "\e[M\x63\x36\x2b" !DECRQM on mouse button mode PUSH "\e[?1000\$p" @@ -179,3 +183,9 @@ RESET MOUSEMOVE 0,0 0 MOUSEBTN d 1 0 MOUSEBTN u 1 0 + +!DECSM can set multiple modes at once +PUSH "\e[?1002;1006h" + settermprop 8 2 +MOUSEBTN d 1 0 + output "\e[<0;1;1M" diff --git a/src/libvterm/t/25state_input.test b/src/libvterm/t/25state_input.test index 4eb4c6abdf..11013ed9ba 100644 --- a/src/libvterm/t/25state_input.test +++ b/src/libvterm/t/25state_input.test @@ -148,7 +148,9 @@ FOCUS IN FOCUS OUT !Focus reporting enabled +WANTSTATE +p PUSH "\e[?1004h" + settermprop 9 true FOCUS IN output "\e[I" FOCUS OUT diff --git a/src/libvterm/t/30state_pen.test b/src/libvterm/t/30state_pen.test index 92cf01d855..1a6cd01dd1 100644 --- a/src/libvterm/t/30state_pen.test +++ b/src/libvterm/t/30state_pen.test @@ -123,3 +123,11 @@ PUSH "\e[74m" PUSH "\e[75m" ?pen small = off ?pen baseline = normal + +!DECSTR resets pen attributes +PUSH "\e[1;4m" + ?pen bold = on + ?pen underline = 1 +PUSH "\e[!p" + ?pen bold = off + ?pen underline = 0 diff --git a/src/libvterm/t/40state_selection.test b/src/libvterm/t/40state_selection.test index 6ed8972fc0..a6a32319f0 100644 --- a/src/libvterm/t/40state_selection.test +++ b/src/libvterm/t/40state_selection.test @@ -26,6 +26,30 @@ PUSH "\e]52;c;SGVsbG" PUSH "8s\e\\" selection-set mask=0001 "lo,"] +!Set clipboard; empty first chunk +PUSH "\e]52;c;" +PUSH "SGVsbG8s\e\\" + selection-set mask=0001 ["Hello,"] + +!Set clipboard; empty final chunk +PUSH "\e]52;c;SGVsbG8s" + selection-set mask=0001 ["Hello," +PUSH "\e\\" + selection-set mask=0001 ] + +!Set clipboard; longer than buffer +PUSH "\e]52;c;" . "LS0t"x10 . "\e\\" + selection-set mask=0001 ["-"x15 + selection-set mask=0001 "-"x15] + +!Clear clipboard +PUSH "\e]52;c;\e\\" + selection-set mask=0001 [] + +!Set invalid data clears and ignores +PUSH "\e]52;c;SGVs*SGVsbG8s\e\\" + selection-set mask=0001 [] + !Query clipboard PUSH "\e]52;c;?\e\\" selection-query mask=0001 diff --git a/src/libvterm/t/64screen_pen.test b/src/libvterm/t/64screen_pen.test index 1cb6324bda..fa15bce959 100644 --- a/src/libvterm/t/64screen_pen.test +++ b/src/libvterm/t/64screen_pen.test @@ -41,21 +41,31 @@ PUSH "x\e[74m0\e[73m2\e[m" ?screen_cell 0,9 = {0x30} width=1 attrs={S_} fg=rgb(240,240,240) bg=rgb(0,0,0) ?screen_cell 0,10 = {0x32} width=1 attrs={S^} fg=rgb(240,240,240) bg=rgb(0,0,0) -!EL sets reverse and colours to end of line +!EL sets only colours to end of line, not other attrs PUSH "\e[H\e[7;33;44m\e[K" - ?screen_cell 0,0 = {} width=1 attrs={R} fg=idx(3) bg=idx(4) - ?screen_cell 0,79 = {} width=1 attrs={R} fg=idx(3) bg=idx(4) - -!DECSCNM xors reverse for entire screen -PUSH "\e[?5h" ?screen_cell 0,0 = {} width=1 attrs={} fg=idx(3) bg=idx(4) ?screen_cell 0,79 = {} width=1 attrs={} fg=idx(3) bg=idx(4) + +!DECSCNM xors reverse for entire screen +PUSH "R\e[?5h" + ?screen_cell 0,0 = {0x52} width=1 attrs={} fg=idx(3) bg=idx(4) ?screen_cell 1,0 = {} width=1 attrs={R} fg=rgb(240,240,240) bg=rgb(0,0,0) PUSH "\e[?5\$p" output "\e[?5;1\$y" PUSH "\e[?5l" - ?screen_cell 0,0 = {} width=1 attrs={R} fg=idx(3) bg=idx(4) - ?screen_cell 0,79 = {} width=1 attrs={R} fg=idx(3) bg=idx(4) + ?screen_cell 0,0 = {0x52} width=1 attrs={R} fg=idx(3) bg=idx(4) ?screen_cell 1,0 = {} width=1 attrs={} fg=rgb(240,240,240) bg=rgb(0,0,0) PUSH "\e[?5\$p" output "\e[?5;2\$y" + +!Set default colours +RESET +PUSH "ABC\e[31mDEF\e[m" + ?screen_cell 0,0 = {0x41} width=1 attrs={} fg=rgb(240,240,240) bg=rgb(0,0,0) + ?screen_cell 0,3 = {0x44} width=1 attrs={} fg=idx(1) bg=rgb(0,0,0) +SETDEFAULTCOL rgb(252,253,254) + ?screen_cell 0,0 = {0x41} width=1 attrs={} fg=rgb(252,253,254) bg=rgb(0,0,0) + ?screen_cell 0,3 = {0x44} width=1 attrs={} fg=idx(1) bg=rgb(0,0,0) +SETDEFAULTCOL rgb(250,250,250) rgb(10,20,30) + ?screen_cell 0,0 = {0x41} width=1 attrs={} fg=rgb(250,250,250) bg=rgb(10,20,30) + ?screen_cell 0,3 = {0x44} width=1 attrs={} fg=idx(1) bg=rgb(10,20,30) diff --git a/src/libvterm/t/69screen_reflow.test b/src/libvterm/t/69screen_reflow.test index 278cc5bdd1..eb7e4e4d95 100644 --- a/src/libvterm/t/69screen_reflow.test +++ b/src/libvterm/t/69screen_reflow.test @@ -77,3 +77,12 @@ RESIZE 5,16 ?lineinfo 3 = ?screen_row 3 = "> " ?cursor = 3,2 + +!Cursor goes missing +# For more context: https://github.com/neovim/neovim/pull/21124 +RESET +RESIZE 5,5 +RESIZE 3,1 +PUSH "\x1b[2;1Habc\r\n\x1b[H" +RESIZE 1,1 + ?cursor = 0,0 diff --git a/src/libvterm/t/harness.c b/src/libvterm/t/harness.c index d12c1205ad..5285d94ec0 100644 --- a/src/libvterm/t/harness.c +++ b/src/libvterm/t/harness.c @@ -82,6 +82,26 @@ static void print_color(const VTermColor *col) printf(")"); } +static VTermColor strpe_color(char **strp) +{ + uint8_t r, g, b, idx; + int len = 0; + VTermColor col; + + if(sscanf(*strp, "rgb(%hhu,%hhu,%hhu)%n", &r, &g, &b, &len) == 3 && len > 0) { + *strp += len; + vterm_color_rgb(&col, r, g, b); + } + else if(sscanf(*strp, "idx(%hhu)%n", &idx, &len) == 1 && len > 0) { + *strp += len; + vterm_color_indexed(&col, idx); + } + else + vterm_color_rgb(&col, 127, 127, 127); + + return col; +} + static VTerm *vt; static VTermState *state; static VTermScreen *screen; @@ -669,7 +689,10 @@ int main(int argc UNUSED, char **argv UNUSED) if(!state) { state = vterm_obtain_state(vt); vterm_state_set_callbacks(state, &state_cbs, NULL); - vterm_state_set_selection_callbacks(state, &selection_cbs, NULL, NULL, 1024); + /* In some tests we want to check the behaviour of overflowing the + * buffer, so make it nicely small + */ + vterm_state_set_selection_callbacks(state, &selection_cbs, NULL, NULL, 16); vterm_state_set_bold_highbright(state, 1); vterm_state_reset(state, 1); } @@ -942,6 +965,23 @@ int main(int argc UNUSED, char **argv UNUSED) vterm_screen_flush_damage(screen); } + else if(strstartswith(line, "SETDEFAULTCOL ")) { + assert(screen); + char *linep = line + 14; + while(linep[0] == ' ') + linep++; + VTermColor fg = strpe_color(&linep); + if(linep[0]) { + while(linep[0] == ' ') + linep++; + VTermColor bg = strpe_color(&linep); + + vterm_screen_set_default_colors(screen, &fg, &bg); + } + else + vterm_screen_set_default_colors(screen, &fg, NULL); + } + else if(line[0] == '?') { if(streq(line, "?cursor")) { assert(state); diff --git a/src/version.c b/src/version.c index 34f1203cdf..96c1817819 100644 --- a/src/version.c +++ b/src/version.c @@ -695,6 +695,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1684, /**/ 1683, /**/ From 422b9dcbfadcd5c1dfad982f9782563915398430 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Fri, 11 Aug 2023 22:38:48 +0200 Subject: [PATCH 029/163] patch 9.0.1685: silence Python 3.11 depreciations for gcc Problem: Python 3.11 interface throws deprecation warnings Solution: ignore those warnings for gcc and clang Python 3.11 deprecation warnings are already silenced for clang using the pragma ``` # pragma clang diagnostic ignored "-Wdeprecated-declarations" ``` However those warnings are also emitted when using gcc. To avoid them for both compilers, change use the __GNUC__ ifdef, which is defined for gcc as well as clang. Additionally, instead of using the "clang diagnostic ignored" pragma, let's make use of 'GCC diagnostic ignored' which is again supported by clang and GCC closes: #12610 Signed-off-by: Christian Brabandt Co-authored-by: Philip H <47042125+pheiduck@users.noreply.github.com> --- src/if_python3.c | 5 +++-- src/version.c | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/if_python3.c b/src/if_python3.c index 240b88fac7..06c02ce67c 100644 --- a/src/if_python3.c +++ b/src/if_python3.c @@ -82,8 +82,9 @@ #endif // Suppress Python 3.11 depreciations to see useful warnings -#if defined(__clang__) && defined(__clang_major__) && __clang_major__ > 11 -# pragma clang diagnostic ignored "-Wdeprecated-declarations" +#ifdef __GNUC__ +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif // Python 3 does not support CObjects, always use Capsules diff --git a/src/version.c b/src/version.c index 96c1817819..713421813e 100644 --- a/src/version.c +++ b/src/version.c @@ -695,6 +695,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1685, /**/ 1684, /**/ From 5fee11114975b7405b7ccd3ee8758e54bf559760 Mon Sep 17 00:00:00 2001 From: "Devin J. Pohly" Date: Sun, 23 Apr 2023 20:26:59 -0500 Subject: [PATCH 030/163] patch 9.0.1686: undotree() only works for the current buffer Problem: undotree() only works for the current buffer Solution: Add an optional "buffer number" parameter to undotree(). If omitted, use the current buffer for backwards compatibility. closes: #4001 closes: #12292 Signed-off-by: Christian Brabandt Co-authored-by: zeertzjq Co-authored-by: Devin J. Pohly --- runtime/doc/builtin.txt | 9 ++++---- runtime/doc/todo.txt | 1 - runtime/doc/usr_41.txt | 2 +- src/evalfunc.c | 2 +- src/testdir/test_undo.vim | 47 +++++++++++++++++++++++++++++++++++++++ src/undo.c | 40 +++++++++++++++++++++------------ src/version.c | 2 ++ 7 files changed, 82 insertions(+), 21 deletions(-) diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 34f76d6f4e..e74b39740e 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -707,7 +707,7 @@ trunc({expr}) Float truncate Float {expr} type({expr}) Number type of value {expr} typename({expr}) String representation of the type of {expr} undofile({name}) String undo file name for {name} -undotree() List undo file tree +undotree([{buf}]) List undo file tree for buffer {buf} uniq({list} [, {func} [, {dict}]]) List remove adjacent duplicates from a list utf16idx({string}, {idx} [, {countcc} [, {charidx}]]) @@ -10073,9 +10073,10 @@ undofile({name}) *undofile()* Can also be used as a |method|: > GetFilename()->undofile() -undotree() *undotree()* - Return the current state of the undo tree in a dictionary with - the following items: +undotree([{buf}]) *undotree()* + Return the current state of the undo tree for the current + buffer, or for a specific buffer if {buf} is given. The + result is a dictionary with the following items: "seq_last" The highest undo sequence number used. "seq_cur" The sequence number of the current position in the undo tree. This differs from "seq_last" diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 60903f922e..93c19b5140 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -5535,7 +5535,6 @@ Undo: - Undo history wrong when ":next file" re-uses a buffer. (#5426) ex_next() should pass flag to do_argfile(), then to do_ecmd(). Is there a test for this? -- Add buffer argument to undotree(). (#4001) - Undo problem: "g-" doesn't go back, gets stuck. (Björn Linse, 2016 Jul 18) - Undo message is not always properly displayed. Patch by Ken Takata, 2013 oct 3. Doesn't work properly according to Yukihiro Nakadaira. diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 2d6792af47..2112fbb1b4 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -1373,7 +1373,7 @@ Various: *various-functions* libcallnr() idem, returning a number undofile() get the name of the undo file - undotree() return the state of the undo tree + undotree() return the state of the undo tree for a buffer shiftwidth() effective value of 'shiftwidth' diff --git a/src/evalfunc.c b/src/evalfunc.c index 8970ac7937..0903fa8e60 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -2798,7 +2798,7 @@ static funcentry_T global_functions[] = ret_string, f_typename}, {"undofile", 1, 1, FEARG_1, arg1_string, ret_string, f_undofile}, - {"undotree", 0, 0, 0, NULL, + {"undotree", 0, 1, FEARG_1, arg1_buffer, ret_dict_any, f_undotree}, {"uniq", 1, 3, FEARG_1, arg13_sortuniq, ret_first_arg, f_uniq}, diff --git a/src/testdir/test_undo.vim b/src/testdir/test_undo.vim index 2529e21085..461b28f697 100644 --- a/src/testdir/test_undo.vim +++ b/src/testdir/test_undo.vim @@ -93,6 +93,53 @@ func FillBuffer() endfor endfunc +func Test_undotree_bufnr() + new + let buf1 = bufnr() + + normal! Aabc + set ul=100 + + " Save undo tree without bufnr as ground truth for buffer 1 + let d1 = undotree() + + new + let buf2 = bufnr() + + normal! Adef + set ul=100 + + normal! Aghi + set ul=100 + + " Save undo tree without bufnr as ground truth for buffer 2 + let d2 = undotree() + + " Check undotree() with bufnr argument + let d = undotree(buf1) + call assert_equal(d1, d) + call assert_notequal(d2, d) + + let d = undotree(buf2) + call assert_notequal(d1, d) + call assert_equal(d2, d) + + " Switch buffers and check again + wincmd p + + let d = undotree(buf1) + call assert_equal(d1, d) + + let d = undotree(buf2) + call assert_notequal(d1, d) + call assert_equal(d2, d) + + " Drop created windows + set ul& + new + only! +endfunc + func Test_global_local_undolevels() new one set undolevels=5 diff --git a/src/undo.c b/src/undo.c index 9e122f9327..85c46707e6 100644 --- a/src/undo.c +++ b/src/undo.c @@ -3629,7 +3629,7 @@ curbufIsChanged(void) * Recursive. */ static void -u_eval_tree(u_header_T *first_uhp, list_T *list) +u_eval_tree(buf_T *buf, u_header_T *first_uhp, list_T *list) { u_header_T *uhp = first_uhp; dict_T *dict; @@ -3641,9 +3641,9 @@ u_eval_tree(u_header_T *first_uhp, list_T *list) return; dict_add_number(dict, "seq", uhp->uh_seq); dict_add_number(dict, "time", (long)uhp->uh_time); - if (uhp == curbuf->b_u_newhead) + if (uhp == buf->b_u_newhead) dict_add_number(dict, "newhead", 1); - if (uhp == curbuf->b_u_curhead) + if (uhp == buf->b_u_curhead) dict_add_number(dict, "curhead", 1); if (uhp->uh_save_nr > 0) dict_add_number(dict, "save", uhp->uh_save_nr); @@ -3655,7 +3655,7 @@ u_eval_tree(u_header_T *first_uhp, list_T *list) if (alt_list != NULL) { // Recursive call to add alternate undo tree. - u_eval_tree(uhp->uh_alt_next.ptr, alt_list); + u_eval_tree(buf, uhp->uh_alt_next.ptr, alt_list); dict_add_list(dict, "alt", alt_list); } } @@ -3721,28 +3721,40 @@ u_undofile_reset_and_delete(buf_T *buf) #endif /* - * "undotree()" function + * "undotree(expr)" function */ void f_undotree(typval_T *argvars UNUSED, typval_T *rettv) { + typval_T *tv = &argvars[0]; + buf_T *buf; + dict_T *dict; + list_T *list; + + if (in_vim9script() && check_for_opt_buffer_arg(argvars, 0) == FAIL) + return; + + if (tv->v_type == VAR_UNKNOWN) + buf = curbuf; + else + buf = tv_get_buf_from_arg(tv); + if (rettv_dict_alloc(rettv) == FAIL) return; - dict_T *dict = rettv->vval.v_dict; - list_T *list; + dict = rettv->vval.v_dict; - dict_add_number(dict, "synced", (long)curbuf->b_u_synced); - dict_add_number(dict, "seq_last", curbuf->b_u_seq_last); - dict_add_number(dict, "save_last", curbuf->b_u_save_nr_last); - dict_add_number(dict, "seq_cur", curbuf->b_u_seq_cur); - dict_add_number(dict, "time_cur", (long)curbuf->b_u_time_cur); - dict_add_number(dict, "save_cur", curbuf->b_u_save_nr_cur); + dict_add_number(dict, "synced", (long)buf->b_u_synced); + dict_add_number(dict, "seq_last", buf->b_u_seq_last); + dict_add_number(dict, "save_last", buf->b_u_save_nr_last); + dict_add_number(dict, "seq_cur", buf->b_u_seq_cur); + dict_add_number(dict, "time_cur", (long)buf->b_u_time_cur); + dict_add_number(dict, "save_cur", buf->b_u_save_nr_cur); list = list_alloc(); if (list != NULL) { - u_eval_tree(curbuf->b_u_oldhead, list); + u_eval_tree(buf, buf->b_u_oldhead, list); dict_add_list(dict, "entries", list); } } diff --git a/src/version.c b/src/version.c index 713421813e..f4c73e7991 100644 --- a/src/version.c +++ b/src/version.c @@ -695,6 +695,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1686, /**/ 1685, /**/ From d8f981138aa04c15ff87b306e9003df8d4b09d17 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Fri, 11 Aug 2023 14:07:50 -0700 Subject: [PATCH 031/163] Add commentstring for nix file format (#12696) --- runtime/ftplugin/nix.vim | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 runtime/ftplugin/nix.vim diff --git a/runtime/ftplugin/nix.vim b/runtime/ftplugin/nix.vim new file mode 100644 index 0000000000..d417cc7805 --- /dev/null +++ b/runtime/ftplugin/nix.vim @@ -0,0 +1,17 @@ +" Vim filetype plugin +" Language: nix +" Maintainer: Keith Smiley +" Last Change: 2023 Jul 22 + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +" Don't load another plugin for this buffer +let b:did_ftplugin = 1 + +let b:undo_ftplugin = "setl commentstring< comments<" + +setlocal comments=:# +setlocal commentstring=#\ %s From cd4e4e169ab3ff0b9315e5bc16d5ba490ee251ff Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Fri, 11 Aug 2023 23:10:02 +0200 Subject: [PATCH 032/163] .cirrus.yml: skip pkg update for FreeBSD 13.1 (#12767) --- .cirrus.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index 8e764ae5ef..cfe1d8e38c 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -13,7 +13,6 @@ freebsd_task: image_family: freebsd-12-4 timeout_in: 20m install_script: - - pkg update -f - pkg install -y gettext build_script: - NPROC=$(getconf _NPROCESSORS_ONLN) From 7e0bae024d4c1673cff31763227ad52b936fa56f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 11 Aug 2023 23:15:38 +0200 Subject: [PATCH 033/163] patch 9.0.1687: mapset() not properly handling script ID Problem: mapset() not properly handling script ID Solution: replace_termcodes() may accept a script ID closes: #12699 closes: #12697 Signed-off-by: Christian Brabandt Co-authored-by: zeertzjq --- src/clientserver.c | 2 +- src/if_ole.cpp | 2 +- src/map.c | 27 +++++++++++++++------------ src/menu.c | 2 +- src/optionstr.c | 2 +- src/proto/term.pro | 2 +- src/term.c | 6 ++++-- src/terminal.c | 2 +- src/testdir/test_map_functions.vim | 26 +++++++++++++++++++++++++- src/usercmd.c | 2 +- src/version.c | 2 ++ 11 files changed, 53 insertions(+), 22 deletions(-) diff --git a/src/clientserver.c b/src/clientserver.c index 400a4ad3eb..cfc0ab6613 100644 --- a/src/clientserver.c +++ b/src/clientserver.c @@ -34,7 +34,7 @@ server_to_input_buf(char_u *str) // The last but one parameter of replace_termcodes() is TRUE so that the // sequence is recognised - needed for a real backslash. p_cpo = (char_u *)"Bk"; - str = replace_termcodes(str, &ptr, REPTERM_DO_LT, NULL); + str = replace_termcodes(str, &ptr, 0, REPTERM_DO_LT, NULL); p_cpo = cpo_save; if (*ptr != NUL) // trailing CTRL-V results in nothing diff --git a/src/if_ole.cpp b/src/if_ole.cpp index f347387a90..d191010cd0 100644 --- a/src/if_ole.cpp +++ b/src/if_ole.cpp @@ -323,7 +323,7 @@ CVim::SendKeys(BSTR keys) } /* Translate key codes like */ - str = replace_termcodes((char_u *)buffer, &ptr, REPTERM_DO_LT, NULL); + str = replace_termcodes((char_u *)buffer, &ptr, 0, REPTERM_DO_LT, NULL); /* If ptr was set, then a new buffer was allocated, * so we can free the old one. diff --git a/src/map.c b/src/map.c index 6020f63d30..5988445bd1 100644 --- a/src/map.c +++ b/src/map.c @@ -590,9 +590,9 @@ do_map( if (special) flags |= REPTERM_SPECIAL; - new_keys = replace_termcodes(keys, &keys_buf, flags, &did_simplify); + new_keys = replace_termcodes(keys, &keys_buf, 0, flags, &did_simplify); if (did_simplify) - (void)replace_termcodes(keys, &alt_keys_buf, + (void)replace_termcodes(keys, &alt_keys_buf, 0, flags | REPTERM_NO_SIMPLIFY, NULL); keys = new_keys; } @@ -602,7 +602,7 @@ do_map( if (STRICMP(rhs, "") == 0) // "" means nothing rhs = (char_u *)""; else - rhs = replace_termcodes(rhs, &arg_buf, + rhs = replace_termcodes(rhs, &arg_buf, 0, REPTERM_DO_LT | (special ? REPTERM_SPECIAL : 0), NULL); } @@ -1133,7 +1133,7 @@ map_to_exists(char_u *str, char_u *modechars, int abbr) char_u *buf; int retval; - rhs = replace_termcodes(str, &buf, REPTERM_DO_LT, NULL); + rhs = replace_termcodes(str, &buf, 0, REPTERM_DO_LT, NULL); retval = map_to_exists_mode(rhs, mode_str2flags(modechars), abbr); vim_free(buf); @@ -2488,14 +2488,15 @@ get_maparg(typval_T *argvars, typval_T *rettv, int exact) mode = get_map_mode(&which, 0); - keys_simplified = replace_termcodes(keys, &keys_buf, flags, &did_simplify); + keys_simplified = replace_termcodes(keys, &keys_buf, 0, flags, + &did_simplify); rhs = check_map(keys_simplified, mode, exact, FALSE, abbr, &mp, &buffer_local); if (did_simplify) { // When the lhs is being simplified the not-simplified keys are // preferred for printing, like in do_map(). - (void)replace_termcodes(keys, &alt_keys_buf, + (void)replace_termcodes(keys, &alt_keys_buf, 0, flags | REPTERM_NO_SIMPLIFY, NULL); rhs = check_map(alt_keys_buf, mode, exact, FALSE, abbr, &mp, &buffer_local); @@ -2579,7 +2580,8 @@ f_maplist(typval_T *argvars UNUSED, typval_T *rettv) did_simplify = FALSE; lhs = str2special_save(mp->m_keys, TRUE, FALSE); - (void)replace_termcodes(lhs, &keys_buf, flags, &did_simplify); + (void)replace_termcodes(lhs, &keys_buf, 0, flags, + &did_simplify); vim_free(lhs); mapblock2dict(mp, d, @@ -2758,11 +2760,6 @@ f_mapset(typval_T *argvars, typval_T *rettv UNUSED) return; } orig_rhs = rhs; - if (STRICMP(rhs, "") == 0) // "" means nothing - rhs = (char_u *)""; - else - rhs = replace_termcodes(rhs, &arg_buf, - REPTERM_DO_LT | REPTERM_SPECIAL, NULL); noremap = dict_get_number(d, "noremap") ? REMAP_NONE: 0; if (dict_get_number(d, "script") != 0) @@ -2776,6 +2773,12 @@ f_mapset(typval_T *argvars, typval_T *rettv UNUSED) nowait = dict_get_number(d, "nowait") != 0; // mode from the dict is not used + if (STRICMP(rhs, "") == 0) // "" means nothing + rhs = (char_u *)""; + else + rhs = replace_termcodes(rhs, &arg_buf, sid, + REPTERM_DO_LT | REPTERM_SPECIAL, NULL); + if (buffer) { map_table = curbuf->b_maphash; diff --git a/src/menu.c b/src/menu.c index 04cd5f103c..e4008baab4 100644 --- a/src/menu.c +++ b/src/menu.c @@ -394,7 +394,7 @@ ex_menu( else if (modes & MENU_TIP_MODE) map_buf = NULL; // Menu tips are plain text. else - map_to = replace_termcodes(map_to, &map_buf, + map_to = replace_termcodes(map_to, &map_buf, 0, REPTERM_DO_LT | (special ? REPTERM_SPECIAL : 0), NULL); menuarg.modes = modes; #ifdef FEAT_TOOLBAR diff --git a/src/optionstr.c b/src/optionstr.c index 06958aab2c..31e30e195b 100644 --- a/src/optionstr.c +++ b/src/optionstr.c @@ -2102,7 +2102,7 @@ did_set_pastetoggle(optset_T *args UNUSED) // translate key codes like in a mapping if (*p_pt) { - (void)replace_termcodes(p_pt, &p, + (void)replace_termcodes(p_pt, &p, 0, REPTERM_FROM_PART | REPTERM_DO_LT, NULL); if (p != NULL) { diff --git a/src/proto/term.pro b/src/proto/term.pro index 4c93a81306..4150cbe000 100644 --- a/src/proto/term.pro +++ b/src/proto/term.pro @@ -85,7 +85,7 @@ int decode_modifiers(int n); int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen); void term_get_fg_color(char_u *r, char_u *g, char_u *b); void term_get_bg_color(char_u *r, char_u *g, char_u *b); -char_u *replace_termcodes(char_u *from, char_u **bufp, int flags, int *did_simplify); +char_u *replace_termcodes(char_u *from, char_u **bufp, scid_T sid_arg, int flags, int *did_simplify); void show_termcodes(int flags); int show_one_termcode(char_u *name, char_u *code, int printit); void update_tcap(int attr); diff --git a/src/term.c b/src/term.c index 0416acc705..15420450e1 100644 --- a/src/term.c +++ b/src/term.c @@ -6591,6 +6591,8 @@ term_get_bg_color(char_u *r, char_u *g, char_u *b) replace_termcodes( char_u *from, char_u **bufp, + scid_T sid_arg UNUSED, // script ID to use for , + // or 0 to use current_sctx int flags, int *did_simplify) { @@ -6660,12 +6662,12 @@ replace_termcodes( */ if (STRNICMP(src, "", 5) == 0) { - if (current_sctx.sc_sid <= 0) + if (sid_arg < 0 || (sid_arg == 0 && current_sctx.sc_sid <= 0)) emsg(_(e_using_sid_not_in_script_context)); else { char_u *dot; - long sid = current_sctx.sc_sid; + long sid = sid_arg != 0 ? sid_arg : current_sctx.sc_sid; src += 5; if (in_vim9script() diff --git a/src/terminal.c b/src/terminal.c index d235eb34c9..cb889ae19a 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -867,7 +867,7 @@ ex_terminal(exarg_T *eap) vim_free(opt.jo_eof_chars); p = skiptowhite(cmd); *p = NUL; - keys = replace_termcodes(ep + 1, &buf, + keys = replace_termcodes(ep + 1, &buf, 0, REPTERM_FROM_PART | REPTERM_DO_LT | REPTERM_SPECIAL, NULL); opt.jo_set2 |= JO2_EOF_CHARS; opt.jo_eof_chars = vim_strsave(keys); diff --git a/src/testdir/test_map_functions.vim b/src/testdir/test_map_functions.vim index d76c79cb85..4c62f89ff5 100644 --- a/src/testdir/test_map_functions.vim +++ b/src/testdir/test_map_functions.vim @@ -494,8 +494,32 @@ func Test_map_restore() nunmap endfunc -" Test restoring the script context of a mapping +" Test restoring an mapping func Test_map_restore_sid() + func RestoreMap() + const d = maparg('', 'i', v:false, v:true) + iunmap + call mapset('i', v:false, d) + endfunc + + let mapscript =<< trim [CODE] + inoremap Return =42 + inoremap