Compare commits

...

18 Commits

Author SHA1 Message Date
Bram Moolenaar
3ccb579516 patch 8.2.3689: ex_let_one() is too long
Problem:    ex_let_one() is too long.
Solution:   Split into multiple functions.
2021-11-28 19:53:42 +00:00
Christian Brabandt
2e0f3ecb70 patch 8.2.3688: the window title is not updated when dragging the scrollbar
Problem:    The window title is not updated when dragging the scrollbar.
Solution:   Call maketitle(). (Christian Brabandt, closes #9238, closes #5383)
2021-11-28 18:41:05 +00:00
Bram Moolenaar
59f4f9505a patch 8.2.3687: blockwise insert does not handle autoindent properly
Problem:    Blockwise insert does not handle autoindent properly when tab is
            inserted.
Solution:   Adjust text column for indent before computing column.
            (closes #9229)
2021-11-27 22:47:43 +00:00
Bram Moolenaar
3d14c0f2b9 patch 8.2.3686: filetype detection often mixes up Forth and F#
Problem:    Filetype detection often mixes up Forth and F#.
Solution:   Add a function to inspect the file contents. (Doug Kearns)
2021-11-27 17:22:07 +00:00
Bram Moolenaar
c07f11e42f patch 8.2.3685: Visual studio project files are not recognized
Problem:    Visual studio project files are not recognized.
Solution:   Use the xml file type. (Doug Kearns)
2021-11-27 14:31:47 +00:00
Bram Moolenaar
e9b0b40b79 patch 8.2.3684: blockwise insert does not handle autoindent properly
Problem:    Blockwise insert does not handle autoindent properly.
Solution:   Adjust text column for indent. (closes #9229)
2021-11-27 13:28:24 +00:00
Bram Moolenaar
279d733dfb patch 8.2.3683: Vim9: cannot use in :...do commands
Problem:    Vim9: cannot use  in :...do commands.
Solution:   Add EX_EXPAND to the commands. (closes #9232)
2021-11-27 11:42:50 +00:00
Bram Moolenaar
6304be625c Update runtime files. 2021-11-27 10:57:26 +00:00
Bram Moolenaar
7824fc80f6 patch 8.2.3682: Vim9: assigning to a script variable drops the type
Problem:    Vim9: assigning to a script variable drops the required type.
Solution:   Lookup the type of the variable and use it. (closes #9219)
2021-11-26 17:36:51 +00:00
Bram Moolenaar
bfc5786a61 patch 8.2.3681: cannot drag popup window after click on a status line
Problem:    Cannot drag popup window after click on a status line. (Sergey
            Vlasov)
Solution:   Reset on_status_line. (closes #9221)
2021-11-26 15:57:40 +00:00
DungSaga
d1d8a595bd patch 8.2.3680: repeated code in xxd
Problem:    Repeated code in xxd.
Solution:   Change exit_on_ferror() to getc_or_die(). (closes #9226)
2021-11-26 13:59:27 +00:00
Doug Kearns
7329cfab36 patch 8.2.3679: objc file detected as Octave
Problem:    objc file detected as Octave. (Antony Lee)
Solution:   Detect objc by preprocessor lines. (Doug Kearns, closes #9223,
            closes #9220)
2021-11-26 13:01:41 +00:00
Bram Moolenaar
85be8563fe patch 8.2.3678: illegal memory access
Problem:    Illegal memory access.
Solution:   Ignore changed indent when computing byte offset.
2021-11-25 20:40:11 +00:00
Bram Moolenaar
4d07253a48 patch 8.2.3677: after a put the '] mark is on the last byte
Problem:    After a put the '] mark is on the last byte of a multi-byte
            character.
Solution:   Move it to the first byte. (closes #9047)
2021-11-25 19:31:15 +00:00
Bram Moolenaar
309ce25189 patch 8.2.3676: unused runtime file
Problem:    Unused runtime file.
Solution:   Remove rgb.txt.
2021-11-25 15:11:03 +00:00
Bram Moolenaar
ba8c92687d patch 8.2.3675: using freed memory when vim_strsave() fails
Problem:    Using freed memory when vim_strsave() fails.
Solution:   Clear "last_sourcing_name".  Check for msg_source() called
            recursively. (closes #8217)
2021-11-25 14:43:18 +00:00
Bram Moolenaar
96e7a5928e patch 8.2.3674: when ml_get_buf() fails it messes up IObuff
Problem:    When ml_get_buf() fails it messes up IObuff.
Solution:   Return a local pointer. (closes #9214)
2021-11-25 13:52:37 +00:00
Bram Moolenaar
0bd8d05638 patch 8.2.3673: crash when allocating signal stack fails
Problem:    Crash when allocating signal stack fails.
Solution:   Only using sourcing info when available. (closes #9215)
2021-11-25 13:39:28 +00:00
38 changed files with 807 additions and 1191 deletions

View File

@@ -219,6 +219,23 @@ func dist#ft#FTe()
endif
endfunc
" Distinguish between Forth and F#.
" Provided by Doug Kearns.
func dist#ft#FTfs()
if exists("g:filetype_fs")
exe "setf " . g:filetype_fs
else
let line = getline(nextnonblank(1))
" comments and colon definitions
if line =~ '^\s*\.\=( ' || line =~ '^\s*\\G\= ' || line =~ '^\\$'
\ || line =~ '^\s*: \S'
setf forth
else
setf fs
endif
endif
endfunc
" Distinguish between HTML, XHTML and Django
func dist#ft#FThtml()
let n = 1
@@ -272,6 +289,8 @@ func dist#ft#FTm()
" excluding end(for|function|if|switch|while) common to Murphi
let octave_block_terminators = '\<end\%(_try_catch\|classdef\|enumeration\|events\|methods\|parfor\|properties\)\>'
let objc_preprocessor = '^\s*#\s*\%(import\|include\|define\|if\|ifn\=def\|undef\|line\|error\|pragma\)\>'
let n = 1
let saw_comment = 0 " Whether we've seen a multiline comment leader.
while n < 100
@@ -282,7 +301,7 @@ func dist#ft#FTm()
" anything more definitive.
let saw_comment = 1
endif
if line =~ '^\s*\(#\s*\(include\|import\)\>\|@import\>\|//\)'
if line =~ '^\s*//' || line =~ '^\s*@import\>' || line =~ objc_preprocessor
setf objc
return
endif

View File

@@ -226,7 +226,13 @@ fu! Result(err)
endif
endfu
call Test_check_colors()
let &cpo = s:save_cpo
unlet s:save_cpo
try
call Test_check_colors()
catch
echohl ErrorMsg
echomsg v:exception
echohl NONE
finally
let &cpo = s:save_cpo
unlet s:save_cpo
endtry

View File

@@ -1,4 +1,4 @@
*cmdline.txt* For Vim version 8.2. Last change: 2021 Aug 06
*cmdline.txt* For Vim version 8.2. Last change: 2021 Nov 22
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -925,9 +925,11 @@ Note: these are typed literally, they are not special keys!
*:<sfile>* *<sfile>*
<sfile> When executing a ":source" command, is replaced with the
file name of the sourced file. *E498*
When executing a function, is replaced with the call stack,
as with <stack> (this is for backwards compatibility, using
<stack> is preferred).
When executing a legacy function, is replaced with the call
stack, as with <stack> (this is for backwards
compatibility, using <stack> is preferred).
In Vim9 script using <sfile> in a function gives error
*E1245* .
Note that filename-modifiers are useless when <sfile> is
not used inside a script.
*:<stack>* *<stack>*

View File

@@ -9770,6 +9770,7 @@ setbufline({buf}, {lnum}, {text}) *setbufline()*
For the use of {buf}, see |bufname()| above.
{lnum} is used like with |setline()|.
Use "$" to refer to the last line in buffer {buf}.
When {lnum} is just below the last line the {text} will be
added below the last line.

View File

@@ -139,18 +139,19 @@ can be used to overrule the filetype used for certain extensions:
file name variable ~
*.asa g:filetype_asa |ft-aspvbs-syntax| |ft-aspperl-syntax|
*.asp g:filetype_asp |ft-aspvbs-syntax| |ft-aspperl-syntax|
*.asm g:asmsyntax |ft-asm-syntax|
*.prg g:filetype_prg
*.pl g:filetype_pl
*.inc g:filetype_inc
*.w g:filetype_w |ft-cweb-syntax|
*.asp g:filetype_asp |ft-aspvbs-syntax| |ft-aspperl-syntax|
*.fs g:filetype_fs |ft-forth-syntax|
*.i g:filetype_i |ft-progress-syntax|
*.inc g:filetype_inc
*.m g:filetype_m |ft-mathematica-syntax|
*.p g:filetype_p |ft-pascal-syntax|
*.pl g:filetype_pl
*.pp g:filetype_pp |ft-pascal-syntax|
*.prg g:filetype_prg
*.sh g:bash_is_sh |ft-sh-syntax|
*.tex g:tex_flavor |ft-tex-plugin|
*.w g:filetype_w |ft-cweb-syntax|
*filetype-ignore*
To avoid that certain files are being inspected, the g:ft_ignore_pat variable
@@ -538,6 +539,14 @@ Options:
For further discussion of fortran_have_tabs and the method used for the
detection of source format see |ft-fortran-syntax|.
GPROF *ft-gprof-plugin*
The gprof filetype plugin defines a mapping <C-]> to jump from a function
entry in the gprof flat profile or from a function entry in the call graph
to the details of that function in the call graph.
The mapping can be disabled with: >
let g:no_gprof_maps = 1
GIT COMMIT *ft-gitcommit-plugin*

View File

@@ -1,4 +1,4 @@
*options.txt* For Vim version 8.2. Last change: 2021 Nov 18
*options.txt* For Vim version 8.2. Last change: 2021 Nov 24
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@@ -1,4 +1,4 @@
*repeat.txt* For Vim version 8.2. Last change: 2021 Sep 09
*repeat.txt* For Vim version 8.2. Last change: 2021 Nov 24
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -792,6 +792,10 @@ won't be very helpful.
There is a separate command-line history for debug mode.
NOTE: In Vim9 script, if a command is written at the script level and
continues on the next line, not using the old way with a backslash for line
continuation, only the first line is printed before the debugging prompt.
The line number for a function line is relative to the start of the function.
If you have trouble figuring out where you are, edit the file that defines
the function in another Vim, search for the start of the function and do

View File

@@ -148,6 +148,10 @@ See |sign_define()| for the equivalent Vim script function.
texthl={group}
Highlighting group used for the text item.
culhl={group}
Highlighting group used for the text item when the cursor is
on the same line as the sign and 'cursorline' is enabled.
Example: >
:sign define MySign text=>> texthl=Search linehl=DiffText
<
@@ -173,13 +177,6 @@ See |sign_getdefined()| for the equivalent Vim script function.
:sign list {name}
Lists one defined sign and its attributes.
culhl={group}
Highlighting group used for the text item when the cursor is
on the same line as the sign and 'cursorline' is enabled.
Example: >
:sign define MySign text=>> texthl=Search linehl=DiffText
<
PLACING SIGNS *:sign-place* *E158*

View File

@@ -1533,6 +1533,14 @@ gvim display. Here, statements are colored LightYellow instead of Yellow, and
conditionals are LightBlue for better distinction.
FORTH *forth.vim* *ft-forth-syntax*
Files matching "*.fs" could be F# or Forth. If the automatic detection
doesn't work for you, or you don't edit F# at all, use this in your
startup vimrc: >
:let filetype_fs = "forth"
FORTRAN *fortran.vim* *ft-fortran-syntax*
Default highlighting and dialect ~

View File

@@ -3999,6 +3999,7 @@ E1239 eval.txt /*E1239*
E124 eval.txt /*E124*
E1243 options.txt /*E1243*
E1244 message.txt /*E1244*
E1245 cmdline.txt /*E1245*
E125 eval.txt /*E125*
E126 eval.txt /*E126*
E127 eval.txt /*E127*
@@ -7321,7 +7322,9 @@ hl-Cursor syntax.txt /*hl-Cursor*
hl-CursorColumn syntax.txt /*hl-CursorColumn*
hl-CursorIM syntax.txt /*hl-CursorIM*
hl-CursorLine syntax.txt /*hl-CursorLine*
hl-CursorLineFold syntax.txt /*hl-CursorLineFold*
hl-CursorLineNr syntax.txt /*hl-CursorLineNr*
hl-CursorLineSign syntax.txt /*hl-CursorLineSign*
hl-DiffAdd syntax.txt /*hl-DiffAdd*
hl-DiffChange syntax.txt /*hl-DiffChange*
hl-DiffDelete syntax.txt /*hl-DiffDelete*

View File

@@ -1,4 +1,4 @@
*todo.txt* For Vim version 8.2. Last change: 2021 Nov 14
*todo.txt* For Vim version 8.2. Last change: 2021 Nov 26
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -38,9 +38,7 @@ browser use: https://github.com/vim/vim/issues/1234
*known-bugs*
-------------------- Known bugs and current work -----------------------
mark ends up on last byte of char. (#9047)
Delete runtime/rgb.txt after a while
refactor ex_let_one() to subfunctions.
Vim9 - Make everything work:
- "filter #pat# ls" should work, #pat# is not a comment
@@ -222,8 +220,6 @@ Terminal emulator window:
- When 'encoding' is not utf-8, or the job is using another encoding, setup
conversions.
Include patch #6290: recognize shell directory change.
When using 'cryptmethod' xchaha20 the undo file is not encrypted.
Need to handle extra bytes.
@@ -233,6 +229,8 @@ Fails in line 64 of Ch_communicate, no exception is thrown.
Patch for Template string: #4634
Have another look at the implementation.
Add expanding <script> which works like <sfile> everywhere. #9189
Rename getdigraphlist -> digraph_getlist() etc.
Valgrind reports memory leaks in test_options.

View File

@@ -1,4 +1,4 @@
*vim9.txt* For Vim version 8.2. Last change: 2021 Sep 13
*vim9.txt* For Vim version 8.2. Last change: 2021 Nov 22
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -821,6 +821,10 @@ error. Example: >
For loop ~
The loop variable must not exist yet: >
var i = 1
for i in [1, 2, 3] # Error!
Legacy Vim script has some tricks to make a for loop over a list handle
deleting items at the current or previous item. In Vim9 script it just uses
the index, if items are deleted then items in the list will be skipped.

View File

@@ -632,7 +632,10 @@ au BufNewFile,BufRead auto.master setf conf
au BufNewFile,BufRead *.mas,*.master setf master
" Forth
au BufNewFile,BufRead *.fs,*.ft,*.fth setf forth
au BufNewFile,BufRead *.ft,*.fth setf forth
" F# or Forth
au BufNewFile,BufRead *.fs call dist#ft#FTfs()
" Reva Forth
au BufNewFile,BufRead *.frt setf reva
@@ -2059,9 +2062,15 @@ au BufNewFile,BufRead *.xml call dist#ft#FTxml()
" XMI (holding UML models) is also XML
au BufNewFile,BufRead *.xmi setf xml
" CSPROJ files are Visual Studio.NET's XML-based project config files
" CSPROJ files are Visual Studio.NET's XML-based C# project config files
au BufNewFile,BufRead *.csproj,*.csproj.user setf xml
" FSPROJ files are Visual Studio.NET's XML-based F# project config files
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
" Qt Linguist translation source and Qt User Interface Files are XML
" However, for .ts Typescript is more common.
au BufNewFile,BufRead *.ui setf xml

View File

@@ -4,7 +4,7 @@
" Acknowledgement: Based off of vim-jsonc maintained by Kevin Locke <kevin@kevinlocke.name>
" https://github.com/kevinoid/vim-jsonc
" License: MIT
" Last Change: 2021-07-01
" Last Change: 2021 Nov 22
runtime! ftplugin/json.vim
@@ -14,14 +14,8 @@ else
let b:did_ftplugin_jsonc = 1
endif
" A list of commands that undo buffer local changes made below.
let s:undo_ftplugin = []
" Set comment (formatting) related options. {{{1
setlocal commentstring=//%s comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
call add(s:undo_ftplugin, 'commentstring< comments<')
" Let Vim know how to disable the plug-in.
call map(s:undo_ftplugin, "'execute ' . string(v:val)")
let b:undo_ftplugin = join(s:undo_ftplugin, ' | ')
unlet s:undo_ftplugin
let b:undo_ftplugin = 'setlocal commentstring< comments<'

View File

@@ -2,7 +2,7 @@
"
" Author: Bram Moolenaar
" Copyright: Vim license applies, see ":help license"
" Last Change: 2021 Nov 21
" Last Change: 2021 Nov 27
"
" WORK IN PROGRESS - Only the basics work
" Note: On MS-Windows you need a recent version of gdb. The one included with
@@ -96,6 +96,7 @@ endfunc
call s:Highlight(1, '', &background)
hi default debugBreakpoint term=reverse ctermbg=red guibg=red
hi default debugBreakpointDisabled term=reverse ctermbg=gray guibg=gray
func s:StartDebug(bang, ...)
" First argument is the command to debug, second core file or process ID.
@@ -229,14 +230,28 @@ func s:StartDebug_term(dict)
endif
let commpty = job_info(term_getjob(s:commbuf))['tty_out']
" Open a terminal window to run the debugger.
" Add -quiet to avoid the intro message causing a hit-enter prompt.
let gdb_args = get(a:dict, 'gdb_args', [])
let proc_args = get(a:dict, 'proc_args', [])
let cmd = [g:termdebugger, '-quiet', '-tty', pty, '--eval-command', 'echo startupdone\n'] + gdb_args
call ch_log('executing "' . join(cmd) . '"')
let s:gdbbuf = term_start(cmd, {
let gdb_cmd = [g:termdebugger]
" Add -quiet to avoid the intro message causing a hit-enter prompt.
let gdb_cmd += ['-quiet']
" Disable pagination, it causes everything to stop at the gdb
let gdb_cmd += ['-iex', 'set pagination off']
" Interpret commands while the target is running. This should usually only
" be exec-interrupt, since many commands don't work properly while the
" target is running (so execute during startup).
let gdb_cmd += ['-iex', 'set mi-async on']
" Open a terminal window to run the debugger.
let gdb_cmd += ['-tty', pty]
" Command executed _after_ startup is done, provides us with the necessary feedback
let gdb_cmd += ['-ex', 'echo startupdone\n']
" Adding arguments requested by the user
let gdb_cmd += gdb_args
call ch_log('executing "' . join(gdb_cmd) . '"')
let s:gdbbuf = term_start(gdb_cmd, {
\ 'term_finish': 'close',
\ })
if s:gdbbuf == 0
@@ -255,8 +270,8 @@ func s:StartDebug_term(dict)
for lnum in range(1, 200)
if term_getline(s:gdbbuf, lnum) =~ 'startupdone'
let try_count = 9999
break
let try_count = 9999
break
endif
endfor
let try_count += 1
@@ -269,7 +284,7 @@ func s:StartDebug_term(dict)
" Set arguments to be run.
if len(proc_args)
call term_sendkeys(s:gdbbuf, 'set args ' . join(proc_args) . "\r")
call term_sendkeys(s:gdbbuf, 'server set args ' . join(proc_args) . "\r")
endif
" Connect gdb to the communication pty, using the GDB/MI interface.
@@ -289,20 +304,21 @@ func s:StartDebug_term(dict)
let line1 = term_getline(s:gdbbuf, lnum)
let line2 = term_getline(s:gdbbuf, lnum + 1)
if line1 =~ 'new-ui mi '
" response can be in the same line or the next line
let response = line1 . line2
if response =~ 'Undefined command'
echoerr 'Sorry, your gdb is too old, gdb 7.12 is required'
call s:CloseBuffers()
return
endif
if response =~ 'New UI allocated'
" Success!
break
endif
" response can be in the same line or the next line
let response = line1 . line2
if response =~ 'Undefined command'
echoerr 'Sorry, your gdb is too old, gdb 7.12 is required'
" CHECKME: possibly send a "server show version" here
call s:CloseBuffers()
return
endif
if response =~ 'New UI allocated'
" Success!
break
endif
elseif line1 =~ 'Reading symbols from' && line2 !~ 'new-ui mi '
" Reading symbols might take a while, try more times
let try_count -= 1
" Reading symbols might take a while, try more times
let try_count -= 1
endif
endfor
if response =~ 'New UI allocated'
@@ -316,17 +332,6 @@ func s:StartDebug_term(dict)
sleep 10m
endwhile
" Interpret commands while the target is running. This should usually only be
" exec-interrupt, since many commands don't work properly while the target is
" running.
call s:SendCommand('-gdb-set mi-async on')
" Older gdb uses a different command.
call s:SendCommand('-gdb-set target-async on')
" Disable pagination, it causes everything to stop at the gdb
" "Type <return> to continue" prompt.
call s:SendCommand('set pagination off')
call job_setoptions(term_getjob(s:gdbbuf), {'exit_cb': function('s:EndTermDebug')})
" Set the filetype, this can be used to add mappings.
@@ -356,14 +361,26 @@ func s:StartDebug_prompt(dict)
exe (&columns / 2 - 1) . "wincmd |"
endif
" Add -quiet to avoid the intro message causing a hit-enter prompt.
let gdb_args = get(a:dict, 'gdb_args', [])
let proc_args = get(a:dict, 'proc_args', [])
let cmd = [g:termdebugger, '-quiet', '--interpreter=mi2'] + gdb_args
call ch_log('executing "' . join(cmd) . '"')
let gdb_cmd = [g:termdebugger]
" Add -quiet to avoid the intro message causing a hit-enter prompt.
let gdb_cmd += ['-quiet']
" Disable pagination, it causes everything to stop at the gdb, needs to be run early
let gdb_cmd += ['-iex', 'set pagination off']
" Interpret commands while the target is running. This should usually only
" be exec-interrupt, since many commands don't work properly while the
" target is running (so execute during startup).
let gdb_cmd += ['-iex', 'set mi-async on']
" directly communicate via mi2
let gdb_cmd += ['--interpreter=mi2']
let s:gdbjob = job_start(cmd, {
" Adding arguments requested by the user
let gdb_cmd += gdb_args
call ch_log('executing "' . join(gdb_cmd) . '"')
let s:gdbjob = job_start(gdb_cmd, {
\ 'exit_cb': function('s:EndPromptDebug'),
\ 'out_cb': function('s:GdbOutCallback'),
\ })
@@ -376,13 +393,6 @@ func s:StartDebug_prompt(dict)
set modified
let s:gdb_channel = job_getchannel(s:gdbjob)
" Interpret commands while the target is running. This should usually only
" be exec-interrupt, since many commands don't work properly while the
" target is running.
call s:SendCommand('-gdb-set mi-async on')
" Older gdb uses a different command.
call s:SendCommand('-gdb-set target-async on')
let s:ptybuf = 0
if has('win32')
" MS-Windows: run in a new console window for maximum compatibility
@@ -416,8 +426,6 @@ func s:StartDebug_prompt(dict)
endif
call s:SendCommand('set print pretty on')
call s:SendCommand('set breakpoint pending on')
" Disable pagination, it causes everything to stop at the gdb
call s:SendCommand('set pagination off')
" Set arguments to be run
if len(proc_args)
@@ -504,6 +512,15 @@ func TermDebugSendCommand(cmd)
endif
endfunc
" Send a command only when stopped. Used for :Next and :Step.
func s:SendCommandIfStopped(cmd)
if s:stopped
call s:SendCommand(a:cmd)
else
call ch_log('dropping command, program is running: ' . a:cmd)
endif
endfunc
" Function called when entering a line in the prompt buffer.
func s:PromptCallback(text)
call s:SendCommand(a:text)
@@ -560,32 +577,23 @@ func s:GdbOutCallback(channel, text)
endfunc
" Decode a message from gdb. quotedText starts with a ", return the text up
" to the next ", unescaping characters.
" to the next ", unescaping characters:
" - remove line breaks
" - change \\t to \t
" - change \0xhh to \xhh
" - change \ooo to octal
" - change \\ to \
func s:DecodeMessage(quotedText)
if a:quotedText[0] != '"'
echoerr 'DecodeMessage(): missing quote in ' . a:quotedText
return
endif
let result = ''
let i = 1
while a:quotedText[i] != '"' && i < len(a:quotedText)
if a:quotedText[i] == '\'
let i += 1
if a:quotedText[i] == 'n'
" drop \n
let i += 1
continue
elseif a:quotedText[i] == 't'
" append \t
let i += 1
let result .= "\t"
continue
endif
endif
let result .= a:quotedText[i]
let i += 1
endwhile
return result
return a:quotedText
\->substitute('^"\|".*\|\\n', '', 'g')
\->substitute('\\t', "\t", 'g')
\->substitute('\\0x\(\x\x\)', {-> eval('"\x' .. submatch(1) .. '"')}, 'g')
\->substitute('\\\o\o\o', {-> eval('"' .. submatch(0) .. '"')}, 'g')
\->substitute('\\\\', '\', 'g')
endfunc
" Extract the "name" value from a gdb message with fullname="name".
@@ -763,8 +771,10 @@ func s:CommOutput(chan, msg)
elseif msg != ''
if msg =~ '^\(\*stopped\|\*running\|=thread-selected\)'
call s:HandleCursor(msg)
elseif msg =~ '^\^done,bkpt=' || msg =~ '^=breakpoint-created,' || msg =~ '^=breakpoint-modified,'
call s:HandleNewBreakpoint(msg)
elseif msg =~ '^\^done,bkpt=' || msg =~ '^=breakpoint-created,'
call s:HandleNewBreakpoint(msg, 0)
elseif msg =~ '^=breakpoint-modified,'
call s:HandleNewBreakpoint(msg, 1)
elseif msg =~ '^=breakpoint-deleted,'
call s:HandleBreakpointDelete(msg)
elseif msg =~ '^=thread-group-started'
@@ -798,9 +808,9 @@ func s:InstallCommands()
command -nargs=? Break call s:SetBreakpoint(<q-args>)
command Clear call s:ClearBreakpoint()
command Step call s:SendCommand('-exec-step')
command Over call s:SendCommand('-exec-next')
command Finish call s:SendCommand('-exec-finish')
command Step call s:SendCommandIfStopped('-exec-step')
command Over call s:SendCommandIfStopped('-exec-next')
command Finish call s:SendCommandIfStopped('-exec-finish')
command -nargs=* Run call s:Run(<q-args>)
command -nargs=* Arguments call s:SendCommand('-exec-arguments ' . <q-args>)
@@ -1040,21 +1050,24 @@ endfunc
" clean up expression that may got in because of range
" (newlines and surrounding whitespace)
" As it can also be specified via ex-command for assignments this function
" may not change the "content" parts (like replacing contained spaces
func s:CleanupExpr(expr)
" replace all embedded newlines/tabs/...
let expr = substitute( a:expr, '\s', ' ', 'g')
let expr = substitute(a:expr, '\_s', ' ', 'g')
if &filetype ==# 'cobol'
" extra cleanup for COBOL: _every: expression ends with a period,
" a semicolon nmay be used instead of a space
" a trailing comma is ignored as it commonly separates multiple expr
let expr = substitute(expr, '\..*', '', '')
" extra cleanup for COBOL:
" - a semicolon nmay be used instead of a space
" - a trailing comma or period is ignored as it commonly separates/ends
" multiple expr
let expr = substitute(expr, ';', ' ', 'g')
let expr = substitute(expr, ',*$', '', '')
let expr = substitute(expr, '[,.]\+ *$', '', '')
endif
" get rid of surrounding spaces
let expr = substitute(expr, '^ *\(.*\) *', '\1', '')
" get rid of leading and trailing spaces
let expr = substitute(expr, '^ *', '', '')
let expr = substitute(expr, ' *$', '', '')
return expr
endfunc
@@ -1065,6 +1078,8 @@ let s:evalFromBalloonExpr = 0
func s:HandleEvaluate(msg)
let value = substitute(a:msg, '.*value="\(.*\)"', '\1', '')
let value = substitute(value, '\\"', '"', 'g')
" multi-byte characters arrive in octal form
let value = substitute(value, '\\\o\o\o', {-> eval('"' .. submatch(0) .. '"')}, 'g')
if s:evalFromBalloonExpr
if s:evalFromBalloonExprResult == ''
let s:evalFromBalloonExprResult = s:evalexpr . ': ' . value
@@ -1239,11 +1254,16 @@ endfunc
let s:BreakpointSigns = []
func s:CreateBreakpoint(id, subid)
func s:CreateBreakpoint(id, subid, enabled)
let nr = printf('%d.%d', a:id, a:subid)
if index(s:BreakpointSigns, nr) == -1
call add(s:BreakpointSigns, nr)
exe "sign define debugBreakpoint" . nr . " text=" . substitute(nr, '\..*', '', '') . " texthl=debugBreakpoint"
if a:enabled == "n"
let hiName = "debugBreakpointDisabled"
else
let hiName = "debugBreakpoint"
endif
exe "sign define debugBreakpoint" . nr . " text=" . substitute(nr, '\..*', '', '') . " texthl=" . hiName
endif
endfunc
@@ -1253,7 +1273,7 @@ endfunction
" Handle setting a breakpoint
" Will update the sign that shows the breakpoint
func s:HandleNewBreakpoint(msg)
func s:HandleNewBreakpoint(msg, modifiedFlag)
if a:msg !~ 'fullname='
" a watch or a pending breakpoint does not have a file name
if a:msg =~ 'pending='
@@ -1276,7 +1296,8 @@ func s:HandleNewBreakpoint(msg)
" If "nr" is 123 it becomes "123.0" and subid is "0".
" If "nr" is 123.4 it becomes "123.4.0" and subid is "4"; "0" is discarded.
let [id, subid; _] = map(split(nr . '.0', '\.'), 'v:val + 0')
call s:CreateBreakpoint(id, subid)
let enabled = substitute(msg, '.*enabled="\([yn]\)".*', '\1', '')
call s:CreateBreakpoint(id, subid, enabled)
if has_key(s:breakpoints, id)
let entries = s:breakpoints[id]
@@ -1303,8 +1324,18 @@ func s:HandleNewBreakpoint(msg)
if bufloaded(fname)
call s:PlaceSign(id, subid, entry)
let posMsg = ' at line ' . lnum . '.'
else
let posMsg = ' in ' . fname . ' at line ' . lnum . '.'
endif
echomsg 'Breakpoint ' . nr . ' created at line ' . lnum . '.'
if !a:modifiedFlag
let actionTaken = 'created'
elseif enabled == 'n'
let actionTaken = 'disabled'
else
let actionTaken = 'enabled'
endif
echomsg 'Breakpoint ' . nr . ' ' . actionTaken . posMsg
endfor
endfunc

View File

@@ -1,782 +0,0 @@
255 250 250 snow
248 248 255 ghost white
248 248 255 GhostWhite
245 245 245 white smoke
245 245 245 WhiteSmoke
220 220 220 gainsboro
255 250 240 floral white
255 250 240 FloralWhite
253 245 230 old lace
253 245 230 OldLace
250 240 230 linen
250 235 215 antique white
250 235 215 AntiqueWhite
255 239 213 papaya whip
255 239 213 PapayaWhip
255 235 205 blanched almond
255 235 205 BlanchedAlmond
255 228 196 bisque
255 218 185 peach puff
255 218 185 PeachPuff
255 222 173 navajo white
255 222 173 NavajoWhite
255 228 181 moccasin
255 248 220 cornsilk
255 255 240 ivory
255 250 205 lemon chiffon
255 250 205 LemonChiffon
255 245 238 seashell
240 255 240 honeydew
245 255 250 mint cream
245 255 250 MintCream
240 255 255 azure
240 248 255 alice blue
240 248 255 AliceBlue
230 230 250 lavender
255 240 245 lavender blush
255 240 245 LavenderBlush
255 228 225 misty rose
255 228 225 MistyRose
255 255 255 white
0 0 0 black
47 79 79 dark slate gray
47 79 79 DarkSlateGray
47 79 79 dark slate grey
47 79 79 DarkSlateGrey
105 105 105 dim gray
105 105 105 DimGray
105 105 105 dim grey
105 105 105 DimGrey
112 128 144 slate gray
112 128 144 SlateGray
112 128 144 slate grey
112 128 144 SlateGrey
119 136 153 light slate gray
119 136 153 LightSlateGray
119 136 153 light slate grey
119 136 153 LightSlateGrey
190 190 190 gray
190 190 190 grey
190 190 190 x11 gray
190 190 190 X11Gray
190 190 190 x11 grey
190 190 190 X11Grey
128 128 128 web gray
128 128 128 WebGray
128 128 128 web grey
128 128 128 WebGrey
211 211 211 light grey
211 211 211 LightGrey
211 211 211 light gray
211 211 211 LightGray
25 25 112 midnight blue
25 25 112 MidnightBlue
0 0 128 navy
0 0 128 navy blue
0 0 128 NavyBlue
100 149 237 cornflower blue
100 149 237 CornflowerBlue
72 61 139 dark slate blue
72 61 139 DarkSlateBlue
106 90 205 slate blue
106 90 205 SlateBlue
123 104 238 medium slate blue
123 104 238 MediumSlateBlue
132 112 255 light slate blue
132 112 255 LightSlateBlue
0 0 205 medium blue
0 0 205 MediumBlue
65 105 225 royal blue
65 105 225 RoyalBlue
0 0 255 blue
30 144 255 dodger blue
30 144 255 DodgerBlue
0 191 255 deep sky blue
0 191 255 DeepSkyBlue
135 206 235 sky blue
135 206 235 SkyBlue
135 206 250 light sky blue
135 206 250 LightSkyBlue
70 130 180 steel blue
70 130 180 SteelBlue
176 196 222 light steel blue
176 196 222 LightSteelBlue
173 216 230 light blue
173 216 230 LightBlue
176 224 230 powder blue
176 224 230 PowderBlue
175 238 238 pale turquoise
175 238 238 PaleTurquoise
0 206 209 dark turquoise
0 206 209 DarkTurquoise
72 209 204 medium turquoise
72 209 204 MediumTurquoise
64 224 208 turquoise
0 255 255 cyan
0 255 255 aqua
224 255 255 light cyan
224 255 255 LightCyan
95 158 160 cadet blue
95 158 160 CadetBlue
102 205 170 medium aquamarine
102 205 170 MediumAquamarine
127 255 212 aquamarine
0 100 0 dark green
0 100 0 DarkGreen
85 107 47 dark olive green
85 107 47 DarkOliveGreen
143 188 143 dark sea green
143 188 143 DarkSeaGreen
46 139 87 sea green
46 139 87 SeaGreen
60 179 113 medium sea green
60 179 113 MediumSeaGreen
32 178 170 light sea green
32 178 170 LightSeaGreen
152 251 152 pale green
152 251 152 PaleGreen
0 255 127 spring green
0 255 127 SpringGreen
124 252 0 lawn green
124 252 0 LawnGreen
0 255 0 green
0 255 0 lime
0 255 0 x11 green
0 255 0 X11Green
0 128 0 web green
0 128 0 WebGreen
127 255 0 chartreuse
0 250 154 medium spring green
0 250 154 MediumSpringGreen
173 255 47 green yellow
173 255 47 GreenYellow
50 205 50 lime green
50 205 50 LimeGreen
154 205 50 yellow green
154 205 50 YellowGreen
34 139 34 forest green
34 139 34 ForestGreen
107 142 35 olive drab
107 142 35 OliveDrab
189 183 107 dark khaki
189 183 107 DarkKhaki
240 230 140 khaki
238 232 170 pale goldenrod
238 232 170 PaleGoldenrod
250 250 210 light goldenrod yellow
250 250 210 LightGoldenrodYellow
255 255 224 light yellow
255 255 224 LightYellow
255 255 0 yellow
255 215 0 gold
238 221 130 light goldenrod
238 221 130 LightGoldenrod
218 165 32 goldenrod
184 134 11 dark goldenrod
184 134 11 DarkGoldenrod
188 143 143 rosy brown
188 143 143 RosyBrown
205 92 92 indian red
205 92 92 IndianRed
139 69 19 saddle brown
139 69 19 SaddleBrown
160 82 45 sienna
205 133 63 peru
222 184 135 burlywood
245 245 220 beige
245 222 179 wheat
244 164 96 sandy brown
244 164 96 SandyBrown
210 180 140 tan
210 105 30 chocolate
178 34 34 firebrick
165 42 42 brown
233 150 122 dark salmon
233 150 122 DarkSalmon
250 128 114 salmon
255 160 122 light salmon
255 160 122 LightSalmon
255 165 0 orange
255 140 0 dark orange
255 140 0 DarkOrange
255 127 80 coral
240 128 128 light coral
240 128 128 LightCoral
255 99 71 tomato
255 69 0 orange red
255 69 0 OrangeRed
255 0 0 red
255 105 180 hot pink
255 105 180 HotPink
255 20 147 deep pink
255 20 147 DeepPink
255 192 203 pink
255 182 193 light pink
255 182 193 LightPink
219 112 147 pale violet red
219 112 147 PaleVioletRed
176 48 96 maroon
176 48 96 x11 maroon
176 48 96 X11Maroon
128 0 0 web maroon
128 0 0 WebMaroon
199 21 133 medium violet red
199 21 133 MediumVioletRed
208 32 144 violet red
208 32 144 VioletRed
255 0 255 magenta
255 0 255 fuchsia
238 130 238 violet
221 160 221 plum
218 112 214 orchid
186 85 211 medium orchid
186 85 211 MediumOrchid
153 50 204 dark orchid
153 50 204 DarkOrchid
148 0 211 dark violet
148 0 211 DarkViolet
138 43 226 blue violet
138 43 226 BlueViolet
160 32 240 purple
160 32 240 x11 purple
160 32 240 X11Purple
128 0 128 web purple
128 0 128 WebPurple
147 112 219 medium purple
147 112 219 MediumPurple
216 191 216 thistle
255 250 250 snow1
238 233 233 snow2
205 201 201 snow3
139 137 137 snow4
255 245 238 seashell1
238 229 222 seashell2
205 197 191 seashell3
139 134 130 seashell4
255 239 219 AntiqueWhite1
238 223 204 AntiqueWhite2
205 192 176 AntiqueWhite3
139 131 120 AntiqueWhite4
255 228 196 bisque1
238 213 183 bisque2
205 183 158 bisque3
139 125 107 bisque4
255 218 185 PeachPuff1
238 203 173 PeachPuff2
205 175 149 PeachPuff3
139 119 101 PeachPuff4
255 222 173 NavajoWhite1
238 207 161 NavajoWhite2
205 179 139 NavajoWhite3
139 121 94 NavajoWhite4
255 250 205 LemonChiffon1
238 233 191 LemonChiffon2
205 201 165 LemonChiffon3
139 137 112 LemonChiffon4
255 248 220 cornsilk1
238 232 205 cornsilk2
205 200 177 cornsilk3
139 136 120 cornsilk4
255 255 240 ivory1
238 238 224 ivory2
205 205 193 ivory3
139 139 131 ivory4
240 255 240 honeydew1
224 238 224 honeydew2
193 205 193 honeydew3
131 139 131 honeydew4
255 240 245 LavenderBlush1
238 224 229 LavenderBlush2
205 193 197 LavenderBlush3
139 131 134 LavenderBlush4
255 228 225 MistyRose1
238 213 210 MistyRose2
205 183 181 MistyRose3
139 125 123 MistyRose4
240 255 255 azure1
224 238 238 azure2
193 205 205 azure3
131 139 139 azure4
131 111 255 SlateBlue1
122 103 238 SlateBlue2
105 89 205 SlateBlue3
71 60 139 SlateBlue4
72 118 255 RoyalBlue1
67 110 238 RoyalBlue2
58 95 205 RoyalBlue3
39 64 139 RoyalBlue4
0 0 255 blue1
0 0 238 blue2
0 0 205 blue3
0 0 139 blue4
30 144 255 DodgerBlue1
28 134 238 DodgerBlue2
24 116 205 DodgerBlue3
16 78 139 DodgerBlue4
99 184 255 SteelBlue1
92 172 238 SteelBlue2
79 148 205 SteelBlue3
54 100 139 SteelBlue4
0 191 255 DeepSkyBlue1
0 178 238 DeepSkyBlue2
0 154 205 DeepSkyBlue3
0 104 139 DeepSkyBlue4
135 206 255 SkyBlue1
126 192 238 SkyBlue2
108 166 205 SkyBlue3
74 112 139 SkyBlue4
176 226 255 LightSkyBlue1
164 211 238 LightSkyBlue2
141 182 205 LightSkyBlue3
96 123 139 LightSkyBlue4
198 226 255 SlateGray1
185 211 238 SlateGray2
159 182 205 SlateGray3
108 123 139 SlateGray4
202 225 255 LightSteelBlue1
188 210 238 LightSteelBlue2
162 181 205 LightSteelBlue3
110 123 139 LightSteelBlue4
191 239 255 LightBlue1
178 223 238 LightBlue2
154 192 205 LightBlue3
104 131 139 LightBlue4
224 255 255 LightCyan1
209 238 238 LightCyan2
180 205 205 LightCyan3
122 139 139 LightCyan4
187 255 255 PaleTurquoise1
174 238 238 PaleTurquoise2
150 205 205 PaleTurquoise3
102 139 139 PaleTurquoise4
152 245 255 CadetBlue1
142 229 238 CadetBlue2
122 197 205 CadetBlue3
83 134 139 CadetBlue4
0 245 255 turquoise1
0 229 238 turquoise2
0 197 205 turquoise3
0 134 139 turquoise4
0 255 255 cyan1
0 238 238 cyan2
0 205 205 cyan3
0 139 139 cyan4
151 255 255 DarkSlateGray1
141 238 238 DarkSlateGray2
121 205 205 DarkSlateGray3
82 139 139 DarkSlateGray4
127 255 212 aquamarine1
118 238 198 aquamarine2
102 205 170 aquamarine3
69 139 116 aquamarine4
193 255 193 DarkSeaGreen1
180 238 180 DarkSeaGreen2
155 205 155 DarkSeaGreen3
105 139 105 DarkSeaGreen4
84 255 159 SeaGreen1
78 238 148 SeaGreen2
67 205 128 SeaGreen3
46 139 87 SeaGreen4
154 255 154 PaleGreen1
144 238 144 PaleGreen2
124 205 124 PaleGreen3
84 139 84 PaleGreen4
0 255 127 SpringGreen1
0 238 118 SpringGreen2
0 205 102 SpringGreen3
0 139 69 SpringGreen4
0 255 0 green1
0 238 0 green2
0 205 0 green3
0 139 0 green4
127 255 0 chartreuse1
118 238 0 chartreuse2
102 205 0 chartreuse3
69 139 0 chartreuse4
192 255 62 OliveDrab1
179 238 58 OliveDrab2
154 205 50 OliveDrab3
105 139 34 OliveDrab4
202 255 112 DarkOliveGreen1
188 238 104 DarkOliveGreen2
162 205 90 DarkOliveGreen3
110 139 61 DarkOliveGreen4
255 246 143 khaki1
238 230 133 khaki2
205 198 115 khaki3
139 134 78 khaki4
255 236 139 LightGoldenrod1
238 220 130 LightGoldenrod2
205 190 112 LightGoldenrod3
139 129 76 LightGoldenrod4
255 255 224 LightYellow1
238 238 209 LightYellow2
205 205 180 LightYellow3
139 139 122 LightYellow4
255 255 0 yellow1
238 238 0 yellow2
205 205 0 yellow3
139 139 0 yellow4
255 215 0 gold1
238 201 0 gold2
205 173 0 gold3
139 117 0 gold4
255 193 37 goldenrod1
238 180 34 goldenrod2
205 155 29 goldenrod3
139 105 20 goldenrod4
255 185 15 DarkGoldenrod1
238 173 14 DarkGoldenrod2
205 149 12 DarkGoldenrod3
139 101 8 DarkGoldenrod4
255 193 193 RosyBrown1
238 180 180 RosyBrown2
205 155 155 RosyBrown3
139 105 105 RosyBrown4
255 106 106 IndianRed1
238 99 99 IndianRed2
205 85 85 IndianRed3
139 58 58 IndianRed4
255 130 71 sienna1
238 121 66 sienna2
205 104 57 sienna3
139 71 38 sienna4
255 211 155 burlywood1
238 197 145 burlywood2
205 170 125 burlywood3
139 115 85 burlywood4
255 231 186 wheat1
238 216 174 wheat2
205 186 150 wheat3
139 126 102 wheat4
255 165 79 tan1
238 154 73 tan2
205 133 63 tan3
139 90 43 tan4
255 127 36 chocolate1
238 118 33 chocolate2
205 102 29 chocolate3
139 69 19 chocolate4
255 48 48 firebrick1
238 44 44 firebrick2
205 38 38 firebrick3
139 26 26 firebrick4
255 64 64 brown1
238 59 59 brown2
205 51 51 brown3
139 35 35 brown4
255 140 105 salmon1
238 130 98 salmon2
205 112 84 salmon3
139 76 57 salmon4
255 160 122 LightSalmon1
238 149 114 LightSalmon2
205 129 98 LightSalmon3
139 87 66 LightSalmon4
255 165 0 orange1
238 154 0 orange2
205 133 0 orange3
139 90 0 orange4
255 127 0 DarkOrange1
238 118 0 DarkOrange2
205 102 0 DarkOrange3
139 69 0 DarkOrange4
255 114 86 coral1
238 106 80 coral2
205 91 69 coral3
139 62 47 coral4
255 99 71 tomato1
238 92 66 tomato2
205 79 57 tomato3
139 54 38 tomato4
255 69 0 OrangeRed1
238 64 0 OrangeRed2
205 55 0 OrangeRed3
139 37 0 OrangeRed4
255 0 0 red1
238 0 0 red2
205 0 0 red3
139 0 0 red4
255 20 147 DeepPink1
238 18 137 DeepPink2
205 16 118 DeepPink3
139 10 80 DeepPink4
255 110 180 HotPink1
238 106 167 HotPink2
205 96 144 HotPink3
139 58 98 HotPink4
255 181 197 pink1
238 169 184 pink2
205 145 158 pink3
139 99 108 pink4
255 174 185 LightPink1
238 162 173 LightPink2
205 140 149 LightPink3
139 95 101 LightPink4
255 130 171 PaleVioletRed1
238 121 159 PaleVioletRed2
205 104 137 PaleVioletRed3
139 71 93 PaleVioletRed4
255 52 179 maroon1
238 48 167 maroon2
205 41 144 maroon3
139 28 98 maroon4
255 62 150 VioletRed1
238 58 140 VioletRed2
205 50 120 VioletRed3
139 34 82 VioletRed4
255 0 255 magenta1
238 0 238 magenta2
205 0 205 magenta3
139 0 139 magenta4
255 131 250 orchid1
238 122 233 orchid2
205 105 201 orchid3
139 71 137 orchid4
255 187 255 plum1
238 174 238 plum2
205 150 205 plum3
139 102 139 plum4
224 102 255 MediumOrchid1
209 95 238 MediumOrchid2
180 82 205 MediumOrchid3
122 55 139 MediumOrchid4
191 62 255 DarkOrchid1
178 58 238 DarkOrchid2
154 50 205 DarkOrchid3
104 34 139 DarkOrchid4
155 48 255 purple1
145 44 238 purple2
125 38 205 purple3
85 26 139 purple4
171 130 255 MediumPurple1
159 121 238 MediumPurple2
137 104 205 MediumPurple3
93 71 139 MediumPurple4
255 225 255 thistle1
238 210 238 thistle2
205 181 205 thistle3
139 123 139 thistle4
0 0 0 gray0
0 0 0 grey0
3 3 3 gray1
3 3 3 grey1
5 5 5 gray2
5 5 5 grey2
8 8 8 gray3
8 8 8 grey3
10 10 10 gray4
10 10 10 grey4
13 13 13 gray5
13 13 13 grey5
15 15 15 gray6
15 15 15 grey6
18 18 18 gray7
18 18 18 grey7
20 20 20 gray8
20 20 20 grey8
23 23 23 gray9
23 23 23 grey9
26 26 26 gray10
26 26 26 grey10
28 28 28 gray11
28 28 28 grey11
31 31 31 gray12
31 31 31 grey12
33 33 33 gray13
33 33 33 grey13
36 36 36 gray14
36 36 36 grey14
38 38 38 gray15
38 38 38 grey15
41 41 41 gray16
41 41 41 grey16
43 43 43 gray17
43 43 43 grey17
46 46 46 gray18
46 46 46 grey18
48 48 48 gray19
48 48 48 grey19
51 51 51 gray20
51 51 51 grey20
54 54 54 gray21
54 54 54 grey21
56 56 56 gray22
56 56 56 grey22
59 59 59 gray23
59 59 59 grey23
61 61 61 gray24
61 61 61 grey24
64 64 64 gray25
64 64 64 grey25
66 66 66 gray26
66 66 66 grey26
69 69 69 gray27
69 69 69 grey27
71 71 71 gray28
71 71 71 grey28
74 74 74 gray29
74 74 74 grey29
77 77 77 gray30
77 77 77 grey30
79 79 79 gray31
79 79 79 grey31
82 82 82 gray32
82 82 82 grey32
84 84 84 gray33
84 84 84 grey33
87 87 87 gray34
87 87 87 grey34
89 89 89 gray35
89 89 89 grey35
92 92 92 gray36
92 92 92 grey36
94 94 94 gray37
94 94 94 grey37
97 97 97 gray38
97 97 97 grey38
99 99 99 gray39
99 99 99 grey39
102 102 102 gray40
102 102 102 grey40
105 105 105 gray41
105 105 105 grey41
107 107 107 gray42
107 107 107 grey42
110 110 110 gray43
110 110 110 grey43
112 112 112 gray44
112 112 112 grey44
115 115 115 gray45
115 115 115 grey45
117 117 117 gray46
117 117 117 grey46
120 120 120 gray47
120 120 120 grey47
122 122 122 gray48
122 122 122 grey48
125 125 125 gray49
125 125 125 grey49
127 127 127 gray50
127 127 127 grey50
130 130 130 gray51
130 130 130 grey51
133 133 133 gray52
133 133 133 grey52
135 135 135 gray53
135 135 135 grey53
138 138 138 gray54
138 138 138 grey54
140 140 140 gray55
140 140 140 grey55
143 143 143 gray56
143 143 143 grey56
145 145 145 gray57
145 145 145 grey57
148 148 148 gray58
148 148 148 grey58
150 150 150 gray59
150 150 150 grey59
153 153 153 gray60
153 153 153 grey60
156 156 156 gray61
156 156 156 grey61
158 158 158 gray62
158 158 158 grey62
161 161 161 gray63
161 161 161 grey63
163 163 163 gray64
163 163 163 grey64
166 166 166 gray65
166 166 166 grey65
168 168 168 gray66
168 168 168 grey66
171 171 171 gray67
171 171 171 grey67
173 173 173 gray68
173 173 173 grey68
176 176 176 gray69
176 176 176 grey69
179 179 179 gray70
179 179 179 grey70
181 181 181 gray71
181 181 181 grey71
184 184 184 gray72
184 184 184 grey72
186 186 186 gray73
186 186 186 grey73
189 189 189 gray74
189 189 189 grey74
191 191 191 gray75
191 191 191 grey75
194 194 194 gray76
194 194 194 grey76
196 196 196 gray77
196 196 196 grey77
199 199 199 gray78
199 199 199 grey78
201 201 201 gray79
201 201 201 grey79
204 204 204 gray80
204 204 204 grey80
207 207 207 gray81
207 207 207 grey81
209 209 209 gray82
209 209 209 grey82
212 212 212 gray83
212 212 212 grey83
214 214 214 gray84
214 214 214 grey84
217 217 217 gray85
217 217 217 grey85
219 219 219 gray86
219 219 219 grey86
222 222 222 gray87
222 222 222 grey87
224 224 224 gray88
224 224 224 grey88
227 227 227 gray89
227 227 227 grey89
229 229 229 gray90
229 229 229 grey90
232 232 232 gray91
232 232 232 grey91
235 235 235 gray92
235 235 235 grey92
237 237 237 gray93
237 237 237 grey93
240 240 240 gray94
240 240 240 grey94
242 242 242 gray95
242 242 242 grey95
245 245 245 gray96
245 245 245 grey96
247 247 247 gray97
247 247 247 grey97
250 250 250 gray98
250 250 250 grey98
252 252 252 gray99
252 252 252 grey99
255 255 255 gray100
255 255 255 grey100
169 169 169 dark grey
169 169 169 DarkGrey
169 169 169 dark gray
169 169 169 DarkGray
0 0 139 dark blue
0 0 139 DarkBlue
0 139 139 dark cyan
0 139 139 DarkCyan
139 0 139 dark magenta
139 0 139 DarkMagenta
139 0 0 dark red
139 0 0 DarkRed
144 238 144 light green
144 238 144 LightGreen
220 20 60 crimson
75 0 130 indigo
128 128 0 olive
102 51 153 rebecca purple
102 51 153 RebeccaPurple
192 192 192 silver
0 128 128 teal

View File

@@ -198,6 +198,10 @@ if s:line1 =~# "^#!"
elseif s:name =~# 'fish\>'
set ft=fish
" Gforth
elseif s:name =~# 'gforth\>'
set ft=forth
endif
unlet s:name

View File

@@ -1,8 +1,8 @@
" Vim syntax file
" Language: Vim 8.2 script
" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
" Last Change: November 19, 2021
" Version: 8.2-15
" Last Change: Nov 25, 2021
" Version: 8.2-17
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM
" Automatically generated keyword lists: {{{1
@@ -29,14 +29,14 @@ syn match vimCommand contained "\<z[-+^.=]\=\>"
syn keyword vimStdPlugin contained Arguments Asm Break Cfilter Clear Continue DiffOrig Evaluate Finish Gdb Lfilter Man N[ext] Over P[rint] Program Run S Source Step Stop Termdebug TermdebugCommand TOhtml Winbar XMLent XMLns
" vimOptions are caught only when contained in a vimSet {{{2
syn keyword vimOption contained acd ambw arshape aw backupskip beval bk bri bufhidden cdpath cindent cm colorcolumn completeopt cp cscopeprg csprg culopt def diffexpr ea ei ep eventignore fdi fenc fileformat fkmap foldexpr foldopen fsync gfw gtt guipty hi hkp ignorecase imd imstatusfunc indentkeys isfname js langmap linebreak lmap lw mat maxmemtot mkspellmem mod mousef mousetime nf ofu para penc pm previewwindow printoptions pw qftf relativenumber rightleftcmd ru sbr scrollfocus sel shellcmdflag shellxquote showfulltag signcolumn smc spell splitbelow ssl stmp swapfile sxq tabstop tags tbs termguicolors textmode thesaurusfunc titlestring top ttimeout ttymouse twt undofile varsofttabstop verbosefile viminfofile wak weirdinvert wig wildoptions winheight wm wrapscan
syn keyword vimOption contained ai anti asd awa balloondelay bevalterm bkc briopt buflisted cedit cink cmdheight columns completepopup cpo cscopequickfix csqf cursorbind define diffopt ead ek equalalways ex fdl fencs fileformats flp foldignore foldtext ft ghr guicursor guitablabel hid hl im imdisable imstyle indk isi key langmenu lines lnr lz matchpairs mco ml modeline mousefocus mp nrformats omnifunc paragraphs perldll pmbcs printdevice prompt pythondll quickfixtextfunc remap rl rubydll sc scrolljump selection shellpipe shiftround showmatch siso smd spellcapcheck splitright ssop sts swapsync syn tag tagstack tc termwinkey textwidth tildeop titlestring option to hi "there" tpm ttimeoutlen ttyscroll tx undolevels vartabstop vfile virtualedit warn wfh wildchar wim winminheight wmh write
syn keyword vimOption contained akm antialias autochdir background ballooneval bex bl brk buftype cf cinkeys cmdwinheight com completeslash cpoptions cscoperelative csre cursorcolumn delcombine digraph eadirection emo equalprg expandtab fdls fex fileignorecase fml foldlevel formatexpr gcr gli guifont guitabtooltip hidden hlg imactivatefunc imi inc inex isident keymap langnoremap linespace loadplugins ma matchtime mef mle modelineexpr mousehide mps nu opendevice paste pex pmbfn printencoding pt pythonhome quoteescape renderoptions rlc ruf scb scrolloff selectmode shellquote shiftwidth showmode sj sn spellfile spo st su swb synmaxcol tagbsearch tal tcldll termwinscroll tf timeout tl tr ttm ttytype uc undoreload vb vi visualbell wb wfw wildcharm winaltkeys winminwidth wmnu writeany
syn keyword vimOption contained al ar autoindent backspace balloonevalterm bexpr bo browsedir casemap cfu cino cmp comments concealcursor cpp cscopetag cst cursorline dex dip eb emoji errorbells exrc fdm ff filetype fmr foldlevelstart formatlistpat gd go guifontset helpfile highlight hls imactivatekey iminsert include inf isk keymodel langremap lisp lpl macatsui maxcombine menc mls modelines mousem msm number operatorfunc pastetoggle pexpr popt printexpr pumheight pythonthreedll rdt report rnu ruler scf scrollopt sessionoptions shellredir shm showtabline slm so spelllang spr sta sua swf syntax tagcase tb tenc termwinsize tfu timeoutlen tm ts tty tw udf updatecount vbs viewdir vop wc wh wildignore wincolor winptydll wmw writebackup
syn keyword vimOption contained aleph arab autoread backup balloonexpr bg bomb bs cb ch cinoptions cms commentstring conceallevel cpt cscopetagorder csto cursorlineopt dg dir ed enc errorfile fcl fdn ffs fillchars fo foldmarker formatoptions gdefault gp guifontwide helpheight history hlsearch imaf ims includeexpr infercase iskeyword keywordprg laststatus lispwords lrm magic maxfuncdepth menuitems mm modifiable mousemodel mzq numberwidth opfunc patchexpr pfn pp printfont pumwidth pythonthreehome re restorescreen ro rulerformat scl scs sft shellslash shortmess shq sm softtabstop spelloptions sps stal suffixes switchbuf ta tagfunc tbi term termwintype tgc title to tsl ttybuiltin twk udir updatetime vdir viewoptions vsts wcm whichwrap wildignorecase window winwidth wop writedelay
syn keyword vimOption contained allowrevins arabic autoshelldir backupcopy bdir bh breakat bsdir cc charconvert cinw co compatible confirm crb cscopeverbose csverb cwh dict directory edcompatible encoding errorformat fcs fdo fic fixendofline foldclose foldmethod formatprg gfm grepformat guiheadroom helplang hk ic imak imsearch incsearch insertmode isp km lazyredraw list ls makeef maxmapdepth mfd mmd modified mouses mzquantum nuw osfiletype patchmode ph preserveindent printheader pvh pyx readonly revins rop runtimepath scr sect sh shelltemp shortname si smartcase sol spellsuggest sr startofline suffixesadd sws tabline taglength tbidi termbidi terse tgst titlelen toolbar tsr ttyfast tws ul ur ve vif vts wcr wi wildmenu winfixheight wiv wrap ws
syn keyword vimOption contained altkeymap arabicshape autowrite backupdir bdlay bin breakindent bsk ccv ci cinwords cocu complete copyindent cryptmethod csl cuc debug dictionary display ef endofline esckeys fdc fdt fileencoding fixeol foldcolumn foldminlines fp gfn grepprg guiligatures hf hkmap icon imc imsf inde is isprint kmp lbr listchars lsp makeencoding maxmem mh mmp more mouseshape mzschemedll odev pa path pheader previewheight printmbcharset pvp pyxversion redrawtime ri rs sb scroll sections shcf shelltype showbreak sidescroll smartindent sp spf srr statusline sw sxe tabpagemax tagrelative tbis termencoding textauto thesaurus titleold toolbariconsize tsrfu ttym twsl undodir ut verbose viminfo wa wd wic wildmode winfixwidth wiw wrapmargin ww
syn keyword vimOption contained ambiwidth ari autowriteall backupext belloff binary breakindentopt bt cd cin clipboard cole completefunc cot cscopepathcomp cspc cul deco diff dy efm eol et fde fen fileencodings fk foldenable foldnestmax fs gfs gtl guioptions hh hkmapp iconstring imcmdline imst indentexpr isf joinspaces kp lcs lm luadll makeprg maxmempattern mis mmt mouse mouset mzschemegcdll oft packpath pdev pi previewpopup printmbfont pvw qe regexpengine rightleft rtp sbo scrollbind secure shell shellxescape showcmd sidescrolloff smarttab spc spl ss stl
syn keyword vimOption contained acd ambw arshape aw backupskip beval bk bri bufhidden cdpath cindent cm colorcolumn completeopt cp cscopeprg csprg culopt def diffexpr ea ei ep eventignore fdi fenc fileformat fkmap foldexpr foldopen fsync gfw gtt guipty hi hkp ignorecase imd imstatusfunc indentkeys isfname js langmap linebreak lmap lw mat maxmemtot mkspellmem mod mousef mousetime nf ofu para penc pm previewwindow printoptions pw qftf relativenumber rightleftcmd ru sbr scrollfocus sel shellcmdflag shellxquote showfulltag signcolumn smc spell splitbelow ssl stl sw sxe tabpagemax tagrelative tbis termencoding textauto thesaurus titleold top ttimeout ttymouse twt undofile varsofttabstop verbosefile viminfofile wak weirdinvert wig wildoptions winheight wm wrapscan
syn keyword vimOption contained ai anti asd awa balloondelay bevalterm bkc briopt buflisted cedit cink cmdheight columns completepopup cpo cscopequickfix csqf cursorbind define diffopt ead ek equalalways ex fdl fencs fileformats flp foldignore foldtext ft ghr guicursor guitablabel hid hl im imdisable imstyle indk isi key langmenu lines lnr lz matchpairs mco ml modeline mousefocus mp nrformats omnifunc paragraphs perldll pmbcs printdevice prompt pythondll quickfixtextfunc remap rl rubydll sc scrolljump selection shellpipe shiftround showmatch siso smd spellcapcheck splitright ssop stmp swapfile sxq tabstop tags tbs termguicolors textmode thesaurusfunc titlestring tpm ttimeoutlen ttyscroll tx undolevels vartabstop vfile virtualedit warn wfh wildchar wim winminheight wmh write
syn keyword vimOption contained akm antialias autochdir background ballooneval bex bl brk buftype cf cinkeys cmdwinheight com completeslash cpoptions cscoperelative csre cursorcolumn delcombine digraph eadirection emo equalprg expandtab fdls fex fileignorecase fml foldlevel formatexpr gcr gli guifont guitabtooltip hidden hlg imactivatefunc imi inc inex isident keymap langnoremap linespace loadplugins ma matchtime mef mle modelineexpr mousehide mps nu opendevice paste pex pmbfn printencoding pt pythonhome quoteescape renderoptions rlc ruf scb scrolloff selectmode shellquote shiftwidth showmode sj sn spellfile spo st sts swapsync syn tag tagstack tc termwinkey textwidth tildeop tl tr ttm ttytype uc undoreload vb vi visualbell wb wfw wildcharm winaltkeys winminwidth wmnu writeany
syn keyword vimOption contained al ar autoindent backspace balloonevalterm bexpr bo browsedir casemap cfu cino cmp comments concealcursor cpp cscopetag cst cursorline dex dip eb emoji errorbells exrc fdm ff filetype fmr foldlevelstart formatlistpat gd go guifontset helpfile highlight hls imactivatekey iminsert include inf isk keymodel langremap lisp lpl macatsui maxcombine menc mls modelines mousem msm number operatorfunc pastetoggle pexpr popt printexpr pumheight pythonthreedll rdt report rnu ruler scf scrollopt sessionoptions shellredir shm showtabline slm so spelllang spr sta su swb synmaxcol tagbsearch tal tcldll termwinscroll tf timeout tm ts tty tw udf updatecount vbs viewdir vop wc wh wildignore wincolor winptydll wmw writebackup
syn keyword vimOption contained aleph arab autoread backup balloonexpr bg bomb bs cb ch cinoptions cms commentstring conceallevel cpt cscopetagorder csto cursorlineopt dg dir ed enc errorfile fcl fdn ffs fillchars fo foldmarker formatoptions gdefault gp guifontwide helpheight history hlsearch imaf ims includeexpr infercase iskeyword keywordprg laststatus lispwords lrm magic maxfuncdepth menuitems mm modifiable mousemodel mzq numberwidth opfunc patchexpr pfn pp printfont pumwidth pythonthreehome re restorescreen ro rulerformat scl scs sft shellslash shortmess shq sm softtabstop spelloptions sps stal sua swf syntax tagcase tb tenc termwinsize tfu timeoutlen to tsl ttybuiltin twk udir updatetime vdir viewoptions vsts wcm whichwrap wildignorecase window winwidth wop writedelay
syn keyword vimOption contained allowrevins arabic autoshelldir backupcopy bdir bh breakat bsdir cc charconvert cinw co compatible confirm crb cscopeverbose csverb cwh dict directory edcompatible encoding errorformat fcs fdo fic fixendofline foldclose foldmethod formatprg gfm grepformat guiheadroom helplang hk ic imak imsearch incsearch insertmode isp km lazyredraw list ls makeef maxmapdepth mfd mmd modified mouses mzquantum nuw osfiletype patchmode ph preserveindent printheader pvh pyx readonly revins rop runtimepath scr sect sh shelltemp shortname si smartcase sol spellsuggest sr startofline suffixes switchbuf ta tagfunc tbi term termwintype tgc title toolbar tsr ttyfast tws ul ur ve vif vts wcr wi wildmenu winfixheight wiv wrap ws
syn keyword vimOption contained altkeymap arabicshape autowrite backupdir bdlay bin breakindent bsk ccv ci cinwords cocu complete copyindent cryptmethod csl cuc debug dictionary display ef endofline esckeys fdc fdt fileencoding fixeol foldcolumn foldminlines fp gfn grepprg guiligatures hf hkmap icon imc imsf inde is isprint kmp lbr listchars lsp makeencoding maxmem mh mmp more mouseshape mzschemedll odev pa path pheader previewheight printmbcharset pvp pyxversion redrawtime ri rs sb scroll sections shcf shelltype showbreak sidescroll smartindent sp spf srr statusline suffixesadd sws tabline taglength tbidi termbidi terse tgst titlelen toolbariconsize tsrfu ttym twsl undodir ut verbose viminfo wa wd wic wildmode winfixwidth wiw wrapmargin ww
syn keyword vimOption contained ambiwidth ari autowriteall backupext belloff binary breakindentopt bt cd cin clipboard cole completefunc cot cscopepathcomp cspc cul deco diff dy efm eol et fde fen fileencodings fk foldenable foldnestmax fs gfs gtl guioptions hh hkmapp iconstring imcmdline imst indentexpr isf joinspaces kp lcs lm luadll makeprg maxmempattern mis mmt mouse mouset mzschemegcdll oft packpath pdev pi previewpopup printmbfont pvw qe regexpengine rightleft rtp sbo scrollbind secure shell shellxescape showcmd sidescrolloff smarttab spc spl ss
" vimOptions: These are the turn-off setting variants {{{2
syn keyword vimOption contained noacd noallowrevins noantialias noarabic noarshape noautoindent noautowrite noawa noballoonevalterm nobin nobl nobri noci nocompatible nocp nocscopetag nocst nocul nocursorline nodg noea noedcompatible noemoji noequalalways noet noexrc nofileignorecase nofk nofs nogdefault nohidden nohkmapp nohlsearch noignorecase noimcmdline noincsearch noinsertmode nojs nolazyredraw nolisp noloadplugins nolz nomagic nomle nomodelineexpr nomodified nomousef nomousehide nonumber noopendevice nopi nopreviewwindow nopvw norelativenumber norestorescreen nori norl noro noru nosb noscb noscrollbind noscs nosft noshelltemp noshortname noshowfulltag noshowmode nosm nosmartindent nosmd nosol nosplitbelow nospr nossl nostartofline noswapfile nota notagrelative notbi notbs noterse notextmode notgst notimeout noto notr nottybuiltin notx noundofile novisualbell nowarn noweirdinvert nowfw nowildignorecase nowinfixheight nowiv nowrap nowrite nowritebackup
@@ -763,10 +763,10 @@ if g:vimsyn_embed =~# 'P' && has("pythonx") && filereadable(s:pythonpath)
unlet! b:current_syntax
syn cluster vimFuncBodyList add=vimPythonRegion
exe "syn include @vimPythonScript ".s:pythonpath
VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+py\%[thon][3x]\=\s*<<\s*\z(\S*\)\ze\(\s*#.*\)\=$+ end=+^\z1\ze\(\s*".*\)\=$+ contains=@vimPythonScript
VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+py\%[thon][3x]\=\s*<<\s*$+ end=+\.$+ contains=@vimPythonScript
VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+Py\%[thon]2or3\s*<<\s*\z(\S*\)\ze\(\s*#.*\)\=$+ end=+^\z1\ze\(\s*".*\)\=$+ contains=@vimPythonScript
VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+Py\%[thon]2or3\=\s*<<\s*$+ end=+\.$+ contains=@vimPythonScript
VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+py\%[thon][3x]\=\s*<<\s*\%(trim\s*\)\=\z(\S*\)\ze\(\s*#.*\)\=$+ end=+^\z1\ze\(\s*".*\)\=$+ contains=@vimPythonScript
VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+py\%[thon][3x]\=\s*<<\s*\%(trim\s*\)\=$+ end=+\.$+ contains=@vimPythonScript
VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+Py\%[thon]2or3\s*<<\s*\%(trim\s*\)\=\z(\S*\)\ze\(\s*#.*\)\=$+ end=+^\z1\ze\(\s*".*\)\=$+ contains=@vimPythonScript
VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+Py\%[thon]2or3\=\s*<<\s*\%(trim\s*\)\=$+ end=+\.$+ contains=@vimPythonScript
syn cluster vimFuncBodyList add=vimPythonRegion
else
syn region vimEmbedError start=+py\%[thon]3\=\s*<<\s*\z(.*\)$+ end=+^\z1$+

View File

@@ -1288,6 +1288,240 @@ list_arg_vars(exarg_T *eap, char_u *arg, int *first)
return arg;
}
/*
* Set an environment variable, part of ex_let_one().
*/
static char_u *
ex_let_env(
char_u *arg,
typval_T *tv,
int flags,
char_u *endchars,
char_u *op)
{
char_u *arg_end = NULL;
char_u *name;
int len;
if ((flags & (ASSIGN_CONST | ASSIGN_FINAL))
&& (flags & ASSIGN_FOR_LOOP) == 0)
{
emsg(_("E996: Cannot lock an environment variable"));
return NULL;
}
// Find the end of the name.
++arg;
name = arg;
len = get_env_len(&arg);
if (len == 0)
semsg(_(e_invarg2), name - 1);
else
{
if (op != NULL && vim_strchr((char_u *)"+-*/%", *op) != NULL)
semsg(_(e_letwrong), op);
else if (endchars != NULL
&& vim_strchr(endchars, *skipwhite(arg)) == NULL)
emsg(_(e_unexpected_characters_in_let));
else if (!check_secure())
{
char_u *tofree = NULL;
int c1 = name[len];
char_u *p;
name[len] = NUL;
p = tv_get_string_chk(tv);
if (p != NULL && op != NULL && *op == '.')
{
int mustfree = FALSE;
char_u *s = vim_getenv(name, &mustfree);
if (s != NULL)
{
p = tofree = concat_str(s, p);
if (mustfree)
vim_free(s);
}
}
if (p != NULL)
{
vim_setenv_ext(name, p);
arg_end = arg;
}
name[len] = c1;
vim_free(tofree);
}
}
return arg_end;
}
/*
* Set an option, part of ex_let_one().
*/
static char_u *
ex_let_option(
char_u *arg,
typval_T *tv,
int flags,
char_u *endchars,
char_u *op)
{
char_u *p;
int opt_flags;
char_u *arg_end = NULL;
if ((flags & (ASSIGN_CONST | ASSIGN_FINAL))
&& (flags & ASSIGN_FOR_LOOP) == 0)
{
emsg(_(e_const_option));
return NULL;
}
// Find the end of the name.
p = find_option_end(&arg, &opt_flags);
if (p == NULL || (endchars != NULL
&& vim_strchr(endchars, *skipwhite(p)) == NULL))
emsg(_(e_unexpected_characters_in_let));
else
{
int c1;
long n = 0;
getoption_T opt_type;
long numval;
char_u *stringval = NULL;
char_u *s = NULL;
int failed = FALSE;
c1 = *p;
*p = NUL;
opt_type = get_option_value(arg, &numval, &stringval, opt_flags);
if ((opt_type == gov_bool
|| opt_type == gov_number
|| opt_type == gov_hidden_bool
|| opt_type == gov_hidden_number)
&& (tv->v_type != VAR_STRING || !in_vim9script()))
{
if (opt_type == gov_bool || opt_type == gov_hidden_bool)
// bool, possibly hidden
n = (long)tv_get_bool(tv);
else
// number, possibly hidden
n = (long)tv_get_number(tv);
}
// Avoid setting a string option to the text "v:false" or similar.
// In Vim9 script also don't convert a number to string.
if (tv->v_type != VAR_BOOL && tv->v_type != VAR_SPECIAL
&& (!in_vim9script() || tv->v_type != VAR_NUMBER))
s = tv_get_string_chk(tv);
if (op != NULL && *op != '=')
{
if (((opt_type == gov_bool || opt_type == gov_number) && *op == '.')
|| (opt_type == gov_string && *op != '.'))
{
semsg(_(e_letwrong), op);
failed = TRUE; // don't set the value
}
else
{
// number, in legacy script also bool
if (opt_type == gov_number
|| (opt_type == gov_bool && !in_vim9script()))
{
switch (*op)
{
case '+': n = numval + n; break;
case '-': n = numval - n; break;
case '*': n = numval * n; break;
case '/': n = (long)num_divide(numval, n,
&failed); break;
case '%': n = (long)num_modulus(numval, n,
&failed); break;
}
s = NULL;
}
else if (opt_type == gov_string
&& stringval != NULL && s != NULL)
{
// string
s = concat_str(stringval, s);
vim_free(stringval);
stringval = s;
}
}
}
if (!failed)
{
if (opt_type != gov_string || s != NULL)
{
set_option_value(arg, n, s, opt_flags);
arg_end = p;
}
else
emsg(_(e_stringreq));
}
*p = c1;
vim_free(stringval);
}
return arg_end;
}
/*
* Set a register, part of ex_let_one().
*/
static char_u *
ex_let_register(
char_u *arg,
typval_T *tv,
int flags,
char_u *endchars,
char_u *op)
{
char_u *arg_end = NULL;
if ((flags & (ASSIGN_CONST | ASSIGN_FINAL))
&& (flags & ASSIGN_FOR_LOOP) == 0)
{
emsg(_("E996: Cannot lock a register"));
return NULL;
}
++arg;
if (op != NULL && vim_strchr((char_u *)"+-*/%", *op) != NULL)
semsg(_(e_letwrong), op);
else if (endchars != NULL
&& vim_strchr(endchars, *skipwhite(arg + 1)) == NULL)
emsg(_(e_unexpected_characters_in_let));
else
{
char_u *ptofree = NULL;
char_u *p;
p = tv_get_string_chk(tv);
if (p != NULL && op != NULL && *op == '.')
{
char_u *s = get_reg_contents(*arg == '@'
? '"' : *arg, GREG_EXPR_SRC);
if (s != NULL)
{
p = ptofree = concat_str(s, p);
vim_free(s);
}
}
if (p != NULL)
{
write_reg_contents(*arg == '@' ? '"' : *arg, p, -1, FALSE);
arg_end = arg + 1;
}
vim_free(ptofree);
}
return arg_end;
}
/*
* Set one item of ":let var = expr" or ":let [v1, v2] = list" to its value.
* Returns a pointer to the char just after the var name.
@@ -1303,13 +1537,7 @@ ex_let_one(
char_u *op, // "+", "-", "." or NULL
int var_idx) // variable index for "let [a, b] = list"
{
int c1;
char_u *name;
char_u *p;
char_u *arg_end = NULL;
int len;
int opt_flags;
char_u *tofree = NULL;
if (in_vim9script() && (flags & (ASSIGN_NO_DECL | ASSIGN_DECL)) == 0
&& (flags & (ASSIGN_CONST | ASSIGN_FINAL)) == 0
@@ -1319,207 +1547,32 @@ ex_let_one(
return NULL;
}
// ":let $VAR = expr": Set environment variable.
if (*arg == '$')
{
if ((flags & (ASSIGN_CONST | ASSIGN_FINAL))
&& (flags & ASSIGN_FOR_LOOP) == 0)
{
emsg(_("E996: Cannot lock an environment variable"));
return NULL;
}
// Find the end of the name.
++arg;
name = arg;
len = get_env_len(&arg);
if (len == 0)
semsg(_(e_invarg2), name - 1);
else
{
if (op != NULL && vim_strchr((char_u *)"+-*/%", *op) != NULL)
semsg(_(e_letwrong), op);
else if (endchars != NULL
&& vim_strchr(endchars, *skipwhite(arg)) == NULL)
emsg(_(e_unexpected_characters_in_let));
else if (!check_secure())
{
c1 = name[len];
name[len] = NUL;
p = tv_get_string_chk(tv);
if (p != NULL && op != NULL && *op == '.')
{
int mustfree = FALSE;
char_u *s = vim_getenv(name, &mustfree);
if (s != NULL)
{
p = tofree = concat_str(s, p);
if (mustfree)
vim_free(s);
}
}
if (p != NULL)
{
vim_setenv_ext(name, p);
arg_end = arg;
}
name[len] = c1;
vim_free(tofree);
}
}
// ":let $VAR = expr": Set environment variable.
return ex_let_env(arg, tv, flags, endchars, op);
}
// ":let &option = expr": Set option value.
// ":let &l:option = expr": Set local option value.
// ":let &g:option = expr": Set global option value.
// ":for &ts in range(8)": Set option value for for loop
else if (*arg == '&')
{
if ((flags & (ASSIGN_CONST | ASSIGN_FINAL))
&& (flags & ASSIGN_FOR_LOOP) == 0)
{
emsg(_(e_const_option));
return NULL;
}
// Find the end of the name.
p = find_option_end(&arg, &opt_flags);
if (p == NULL || (endchars != NULL
&& vim_strchr(endchars, *skipwhite(p)) == NULL))
emsg(_(e_unexpected_characters_in_let));
else
{
long n = 0;
getoption_T opt_type;
long numval;
char_u *stringval = NULL;
char_u *s = NULL;
int failed = FALSE;
c1 = *p;
*p = NUL;
opt_type = get_option_value(arg, &numval, &stringval, opt_flags);
if ((opt_type == gov_bool
|| opt_type == gov_number
|| opt_type == gov_hidden_bool
|| opt_type == gov_hidden_number)
&& (tv->v_type != VAR_STRING || !in_vim9script()))
{
if (opt_type == gov_bool || opt_type == gov_hidden_bool)
// bool, possibly hidden
n = (long)tv_get_bool(tv);
else
// number, possibly hidden
n = (long)tv_get_number(tv);
}
// Avoid setting a string option to the text "v:false" or similar.
// In Vim9 script also don't convert a number to string.
if (tv->v_type != VAR_BOOL && tv->v_type != VAR_SPECIAL
&& (!in_vim9script() || tv->v_type != VAR_NUMBER))
s = tv_get_string_chk(tv);
if (op != NULL && *op != '=')
{
if (((opt_type == gov_bool || opt_type == gov_number)
&& *op == '.')
|| (opt_type == gov_string && *op != '.'))
{
semsg(_(e_letwrong), op);
failed = TRUE; // don't set the value
}
else
{
// number, in legacy script also bool
if (opt_type == gov_number
|| (opt_type == gov_bool && !in_vim9script()))
{
switch (*op)
{
case '+': n = numval + n; break;
case '-': n = numval - n; break;
case '*': n = numval * n; break;
case '/': n = (long)num_divide(numval, n,
&failed); break;
case '%': n = (long)num_modulus(numval, n,
&failed); break;
}
s = NULL;
}
else if (opt_type == gov_string
&& stringval != NULL && s != NULL)
{
// string
s = concat_str(stringval, s);
vim_free(stringval);
stringval = s;
}
}
}
if (!failed)
{
if (opt_type != gov_string || s != NULL)
{
set_option_value(arg, n, s, opt_flags);
arg_end = p;
}
else
emsg(_(e_stringreq));
}
*p = c1;
vim_free(stringval);
}
// ":let &option = expr": Set option value.
// ":let &l:option = expr": Set local option value.
// ":let &g:option = expr": Set global option value.
// ":for &ts in range(8)": Set option value for for loop
return ex_let_option(arg, tv, flags, endchars, op);
}
// ":let @r = expr": Set register contents.
else if (*arg == '@')
{
if ((flags & (ASSIGN_CONST | ASSIGN_FINAL))
&& (flags & ASSIGN_FOR_LOOP) == 0)
{
emsg(_("E996: Cannot lock a register"));
return NULL;
}
++arg;
if (op != NULL && vim_strchr((char_u *)"+-*/%", *op) != NULL)
semsg(_(e_letwrong), op);
else if (endchars != NULL
&& vim_strchr(endchars, *skipwhite(arg + 1)) == NULL)
emsg(_(e_unexpected_characters_in_let));
else
{
char_u *ptofree = NULL;
char_u *s;
p = tv_get_string_chk(tv);
if (p != NULL && op != NULL && *op == '.')
{
s = get_reg_contents(*arg == '@' ? '"' : *arg, GREG_EXPR_SRC);
if (s != NULL)
{
p = ptofree = concat_str(s, p);
vim_free(s);
}
}
if (p != NULL)
{
write_reg_contents(*arg == '@' ? '"' : *arg, p, -1, FALSE);
arg_end = arg + 1;
}
vim_free(ptofree);
}
// ":let @r = expr": Set register contents.
return ex_let_register(arg, tv, flags, endchars, op);
}
// ":let var = expr": Set internal variable.
// ":let var: type = expr": Set internal variable with type.
// ":let {expr} = expr": Idem, name made with curly braces
else if (eval_isnamec1(*arg) || *arg == '{')
{
lval_T lv;
char_u *p;
// ":let var = expr": Set internal variable.
// ":let var: type = expr": Set internal variable with type.
// ":let {expr} = expr": Idem, name made with curly braces
p = get_lval(arg, tv, &lv, FALSE, FALSE,
(flags & (ASSIGN_NO_DECL | ASSIGN_DECL))
? GLV_NO_DECL : 0, FNE_CHECK_START);
@@ -1527,7 +1580,9 @@ ex_let_one(
{
if (endchars != NULL && vim_strchr(endchars,
*skipwhite(lv.ll_name_end)) == NULL)
{
emsg(_(e_unexpected_characters_in_let));
}
else
{
set_var_lval(&lv, p, tv, copy, flags, op, var_idx);
@@ -1536,7 +1591,6 @@ ex_let_one(
}
clear_lval(&lv);
}
else
semsg(_(e_invarg2), arg);
@@ -3206,13 +3260,14 @@ set_var(
void
set_var_const(
char_u *name,
type_T *type,
type_T *type_arg,
typval_T *tv_arg,
int copy, // make copy of value in "tv"
int flags_arg, // ASSIGN_CONST, ASSIGN_FINAL, etc.
int var_idx) // index for ":let [a, b] = list"
{
typval_T *tv = tv_arg;
type_T *type = type_arg;
typval_T bool_tv;
dictitem_T *di;
typval_T *dest_tv = NULL;
@@ -3334,13 +3389,18 @@ set_var_const(
if (var_in_vim9script && (flags & ASSIGN_FOR_LOOP) == 0)
{
where_T where = WHERE_INIT;
svar_T *sv = find_typval_in_script(&di->di_tv);
// check the type and adjust to bool if needed
where.wt_index = var_idx;
where.wt_variable = TRUE;
if (check_script_var_type(&di->di_tv, tv, name, where)
== FAIL)
goto failed;
if (sv != NULL)
{
// check the type and adjust to bool if needed
where.wt_index = var_idx;
where.wt_variable = TRUE;
if (check_script_var_type(sv, tv, name, where) == FAIL)
goto failed;
if (type == NULL)
type = sv->sv_type;
}
}
if ((flags & ASSIGN_FOR_LOOP) == 0

View File

@@ -145,7 +145,7 @@ EXCMD(CMD_argdelete, "argdelete", ex_argdelete,
EX_BANG|EX_RANGE|EX_FILES|EX_TRLBAR,
ADDR_ARGUMENTS),
EXCMD(CMD_argdo, "argdo", ex_listdo,
EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_RANGE|EX_DFLALL,
EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_RANGE|EX_DFLALL|EX_EXPAND,
ADDR_ARGUMENTS),
EXCMD(CMD_argedit, "argedit", ex_argedit,
EX_BANG|EX_NEEDARG|EX_RANGE|EX_ZEROR|EX_FILES|EX_CMDARG|EX_ARGOPT|EX_TRLBAR,
@@ -235,7 +235,7 @@ EXCMD(CMD_buffers, "buffers", buflist_list,
EX_BANG|EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
ADDR_NONE),
EXCMD(CMD_bufdo, "bufdo", ex_listdo,
EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_RANGE|EX_DFLALL,
EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_RANGE|EX_DFLALL|EX_EXPAND,
ADDR_BUFFERS),
EXCMD(CMD_bunload, "bunload", ex_bunload,
EX_BANG|EX_RANGE|EX_BUFNAME|EX_COUNT|EX_EXTRA|EX_TRLBAR,
@@ -301,7 +301,7 @@ EXCMD(CMD_cd, "cd", ex_cd,
EX_BANG|EX_FILE1|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
ADDR_NONE),
EXCMD(CMD_cdo, "cdo", ex_listdo,
EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_RANGE|EX_DFLALL,
EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_RANGE|EX_DFLALL|EX_EXPAND,
ADDR_QUICKFIX_VALID),
EXCMD(CMD_center, "center", ex_align,
EX_TRLBAR|EX_RANGE|EX_WHOLEFOLD|EX_EXTRA|EX_CMDWIN|EX_LOCK_OK|EX_MODIFY,
@@ -313,7 +313,7 @@ EXCMD(CMD_cfile, "cfile", ex_cfile,
EX_TRLBAR|EX_FILE1|EX_BANG,
ADDR_NONE),
EXCMD(CMD_cfdo, "cfdo", ex_listdo,
EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_RANGE|EX_DFLALL,
EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_RANGE|EX_DFLALL|EX_EXPAND,
ADDR_QUICKFIX_VALID),
EXCMD(CMD_cfirst, "cfirst", ex_cc,
EX_RANGE|EX_COUNT|EX_TRLBAR|EX_BANG,
@@ -838,7 +838,7 @@ EXCMD(CMD_lcscope, "lcscope", ex_cscope,
EX_EXTRA|EX_NOTRLCOM|EX_XFILE,
ADDR_NONE),
EXCMD(CMD_ldo, "ldo", ex_listdo,
EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_RANGE|EX_DFLALL,
EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_RANGE|EX_DFLALL|EX_EXPAND,
ADDR_QUICKFIX_VALID),
EXCMD(CMD_left, "left", ex_align,
EX_TRLBAR|EX_RANGE|EX_WHOLEFOLD|EX_EXTRA|EX_CMDWIN|EX_LOCK_OK|EX_MODIFY,
@@ -859,7 +859,7 @@ EXCMD(CMD_lfile, "lfile", ex_cfile,
EX_TRLBAR|EX_FILE1|EX_BANG,
ADDR_NONE),
EXCMD(CMD_lfdo, "lfdo", ex_listdo,
EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_RANGE|EX_DFLALL,
EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_RANGE|EX_DFLALL|EX_EXPAND,
ADDR_QUICKFIX_VALID),
EXCMD(CMD_lfirst, "lfirst", ex_cc,
EX_RANGE|EX_COUNT|EX_TRLBAR|EX_BANG,
@@ -1534,7 +1534,7 @@ EXCMD(CMD_tabclose, "tabclose", ex_tabclose,
EX_BANG|EX_RANGE|EX_ZEROR|EX_EXTRA|EX_NOSPC|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
ADDR_TABS),
EXCMD(CMD_tabdo, "tabdo", ex_listdo,
EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_RANGE|EX_DFLALL,
EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_RANGE|EX_DFLALL|EX_EXPAND,
ADDR_TABS),
EXCMD(CMD_tabedit, "tabedit", ex_splitview,
EX_BANG|EX_FILE1|EX_RANGE|EX_ZEROR|EX_CMDARG|EX_ARGOPT|EX_TRLBAR,
@@ -1768,7 +1768,7 @@ EXCMD(CMD_wincmd, "wincmd", ex_wincmd,
EX_NEEDARG|EX_WORD1|EX_RANGE|EX_CMDWIN|EX_LOCK_OK,
ADDR_OTHER),
EXCMD(CMD_windo, "windo", ex_listdo,
EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_RANGE|EX_DFLALL,
EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_RANGE|EX_DFLALL|EX_EXPAND,
ADDR_WINDOWS),
EXCMD(CMD_winpos, "winpos", ex_winpos,
EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,

View File

@@ -288,6 +288,7 @@ EXTERN int msg_no_more INIT(= FALSE); // don't use more prompt, truncate
* Current context is at ga_len - 1.
*/
EXTERN garray_T exestack INIT5(0, 0, sizeof(estack_T), 50, NULL);
#define HAVE_SOURCING_INFO (exestack.ga_data != NULL && exestack.ga_len > 0)
// name of error message source
#define SOURCING_NAME (((estack_T *)exestack.ga_data)[exestack.ga_len - 1].es_name)
// line number in the message source or zero

View File

@@ -4412,6 +4412,10 @@ gui_update_scrollbars(
val, size, max);
}
}
// update the title, it may show the scroll position
maketitle();
prev_curwin = curwin;
--hold_gui_events;
}

View File

@@ -2606,6 +2606,7 @@ ml_get_buf(
bhdr_T *hp;
DATA_BL *dp;
static int recursive = 0;
static char_u questions[4];
if (lnum > buf->b_ml.ml_line_count) // invalid line number
{
@@ -2618,9 +2619,9 @@ ml_get_buf(
--recursive;
}
errorret:
STRCPY(IObuff, "???");
STRCPY(questions, "???");
buf->b_ml.ml_line_len = 4;
return IObuff;
return questions;
}
if (lnum <= 0) // pretend line 0 is line 1
lnum = 1;

View File

@@ -446,7 +446,7 @@ reset_last_sourcing(void)
static int
other_sourcing_name(void)
{
if (SOURCING_NAME != NULL)
if (HAVE_SOURCING_INFO && SOURCING_NAME != NULL)
{
if (last_sourcing_name != NULL)
return STRCMP(SOURCING_NAME, last_sourcing_name) != 0;
@@ -465,7 +465,7 @@ get_emsg_source(void)
{
char_u *Buf, *p;
if (SOURCING_NAME != NULL && other_sourcing_name())
if (HAVE_SOURCING_INFO && SOURCING_NAME != NULL && other_sourcing_name())
{
char_u *sname = estack_sfile(ESTACK_NONE);
char_u *tofree = sname;
@@ -522,6 +522,12 @@ get_emsg_lnum(void)
msg_source(int attr)
{
char_u *p;
static int recursive = FALSE;
// Bail out if something called here causes an error.
if (recursive)
return;
recursive = TRUE;
++no_wait_return;
p = get_emsg_source();
@@ -541,13 +547,13 @@ msg_source(int attr)
// remember the last sourcing name printed, also when it's empty
if (SOURCING_NAME == NULL || other_sourcing_name())
{
vim_free(last_sourcing_name);
if (SOURCING_NAME == NULL)
last_sourcing_name = NULL;
else
VIM_CLEAR(last_sourcing_name);
if (SOURCING_NAME != NULL)
last_sourcing_name = vim_strsave(SOURCING_NAME);
}
--no_wait_return;
recursive = FALSE;
}
/*

View File

@@ -1630,6 +1630,7 @@ retnomove:
if (WIN_IS_POPUP(wp))
{
on_sep_line = 0;
on_status_line = 0;
in_popup_win = TRUE;
if (which_button == MOUSE_LEFT && popup_close_if_on_X(wp, row, col))
{

View File

@@ -1456,7 +1456,8 @@ op_insert(oparg_T *oap, long count1)
{
long ins_len, pre_textlen = 0;
char_u *firstline, *ins_text;
colnr_T ind_pre = 0, ind_post;
colnr_T ind_pre_col = 0, ind_post_col;
int ind_pre_vcol = 0, ind_post_vcol = 0;
struct block_def bd;
int i;
pos_T t1;
@@ -1497,7 +1498,8 @@ op_insert(oparg_T *oap, long count1)
// Get the info about the block before entering the text
block_prep(oap, &bd, oap->start.lnum, TRUE);
// Get indent information
ind_pre = (colnr_T)getwhitecols_curline();
ind_pre_col = (colnr_T)getwhitecols_curline();
ind_pre_vcol = get_indent();
firstline = ml_get(oap->start.lnum) + bd.textcol;
if (oap->op_type == OP_APPEND)
@@ -1563,11 +1565,12 @@ op_insert(oparg_T *oap, long count1)
// If indent kicked in, the firstline might have changed
// but only do that, if the indent actually increased.
ind_post = (colnr_T)getwhitecols_curline();
if (curbuf->b_op_start.col > ind_pre && ind_post > ind_pre)
ind_post_col = (colnr_T)getwhitecols_curline();
if (curbuf->b_op_start.col > ind_pre_col && ind_post_col > ind_pre_col)
{
bd.textcol += ind_post - ind_pre;
bd.start_vcol += ind_post - ind_pre;
bd.textcol += ind_post_col - ind_pre_col;
ind_post_vcol = get_indent();
bd.start_vcol += ind_post_vcol - ind_pre_vcol;
did_indent = TRUE;
}
@@ -1612,12 +1615,28 @@ op_insert(oparg_T *oap, long count1)
}
}
/*
* Spaces and tabs in the indent may have changed to other spaces and
* tabs. Get the starting column again and correct the length.
* Don't do this when "$" used, end-of-line will have changed.
*/
// Spaces and tabs in the indent may have changed to other spaces and
// tabs. Get the starting column again and correct the length.
// Don't do this when "$" used, end-of-line will have changed.
//
// if indent was added and the inserted text was after the indent,
// correct the selection for the new indent.
if (did_indent && bd.textcol - ind_post_col > 0)
{
oap->start.col += ind_post_col - ind_pre_col;
oap->start_vcol += ind_post_vcol - ind_pre_vcol;
oap->end.col += ind_post_col - ind_pre_col;
oap->end_vcol += ind_post_vcol - ind_pre_vcol;
}
block_prep(oap, &bd2, oap->start.lnum, TRUE);
if (did_indent && bd.textcol - ind_post_col > 0)
{
// undo for where "oap" is used below
oap->start.col -= ind_post_col - ind_pre_col;
oap->start_vcol -= ind_post_vcol - ind_pre_vcol;
oap->end.col -= ind_post_col - ind_pre_col;
oap->end_vcol -= ind_post_vcol - ind_pre_vcol;
}
if (!bd.is_MAX || bd2.textlen < bd.textlen)
{
if (oap->op_type == OP_APPEND)

View File

@@ -16,6 +16,6 @@ char_u *vim9_declare_scriptvar(exarg_T *eap, char_u *arg);
void update_vim9_script_var(int create, dictitem_T *di, int flags, typval_T *tv, type_T **type, int do_member);
void hide_script_var(scriptitem_T *si, int idx, int func_defined);
svar_T *find_typval_in_script(typval_T *dest);
int check_script_var_type(typval_T *dest, typval_T *value, char_u *name, where_T where);
int check_script_var_type(svar_T *sv, typval_T *value, char_u *name, where_T where);
int check_reserved_name(char_u *name);
/* vim: set ft=c : */

View File

@@ -2004,6 +2004,7 @@ do_put(
{
linenr_T end_lnum = 0; // init for gcc
linenr_T start_lnum = lnum;
int first_byte_off = 0;
if (VIsual_active)
{
@@ -2065,6 +2066,10 @@ do_put(
}
STRMOVE(ptr, oldp + col);
ml_replace(lnum, newp, FALSE);
// compute the byte offset for the last character
first_byte_off = mb_head_off(newp, ptr - 1);
// Place cursor on last putted char.
if (lnum == curwin->w_cursor.lnum)
{
@@ -2080,15 +2085,21 @@ do_put(
lnum--;
}
// put '] at the first byte of the last character
curbuf->b_op_end = curwin->w_cursor;
curbuf->b_op_end.col -= first_byte_off;
// For "CTRL-O p" in Insert mode, put cursor after last char
if (totlen && (restart_edit != 0 || (flags & PUT_CURSEND)))
++curwin->w_cursor.col;
else
curwin->w_cursor.col -= first_byte_off;
changed_bytes(lnum, col);
}
else
{
linenr_T new_lnum = new_cursor.lnum;
size_t len;
// Insert at least one line. When y_type is MCHAR, break the first
// line in two.
@@ -2198,12 +2209,15 @@ error:
changed_lines(curbuf->b_op_start.lnum, 0,
curbuf->b_op_start.lnum, nr_lines);
// put '] mark at last inserted character
// Put the '] mark on the first byte of the last inserted character.
// Correct the length for change in indent.
curbuf->b_op_end.lnum = new_lnum;
// correct length for change in indent
col = (colnr_T)STRLEN(y_array[y_size - 1]) - lendiff;
len = STRLEN(y_array[y_size - 1]);
col = (colnr_T)len - lendiff;
if (col > 1)
curbuf->b_op_end.col = col - 1;
curbuf->b_op_end.col = col - 1
- mb_head_off(y_array[y_size - 1],
y_array[y_size - 1] + len - 1);
else
curbuf->b_op_end.col = 0;

View File

@@ -0,0 +1,10 @@
>1+0&#ffffff0| @35||+1&&|1+0&&| @35
|2| @15|╔+0#0000001#ffd7ff255|═@9|╗| +0#0000000#ffffff0@7||+1&&|2+0&&| @35
|3| @15|║+0#0000001#ffd7ff255|1@3| @5|║| +0#0000000#ffffff0@7||+1&&|3+0&&| @35
|4| @15|║+0#0000001#ffd7ff255|2@5| @3|║| +0#0000000#ffffff0@7||+1&&|4+0&&| @35
|[+3&&|N|o| |N|a|m|e|]| |[|+|]| @3|║+0#0000001#ffd7ff255|3@4| @4|║| +3#0000000#ffffff0@4|T|o|p| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @5|1|,|1| @11|T|o|p
|1+0&&| @15|║+0#0000001#ffd7ff255| +0#4040ff13&@9|║+0#0000001&| +0#0000000#ffffff0@7||+1&&|1+0&&| @35
|2| @15|╚+0#0000001#ffd7ff255|═@9|⇲| +0#0000000#ffffff0@7||+1&&|2+0&&| @35
|3| @35||+1&&|3+0&&| @35
|[+1&&|N|o| |N|a|m|e|]| |[|+|]| @5|1|,|1| @11|T|o|p| |[|N|o| |N|a|m|e|]| |[|+|]| @5|1|,|1| @11|T|o|p
|:+0&&|c|a|l@1| |C|l|i|c|k|A|n|d|D|r|a|g|(|)| @54

View File

@@ -14,6 +14,58 @@ func Test_blockinsert_indent()
bwipe!
endfunc
func Test_blockinsert_autoindent()
new
let lines =<< trim END
var d = {
a: () => 0,
b: () => 0,
c: () => 0,
}
END
call setline(1, lines)
filetype plugin indent on
setlocal sw=2 et ft=vim
setlocal indentkeys+=:
exe "norm! 2Gf)\<c-v>2jA: asdf\<esc>"
let expected =<< trim END
var d = {
a: (): asdf => 0,
b: (): asdf => 0,
c: (): asdf => 0,
}
END
call assert_equal(expected, getline(1, 5))
" insert on the next column should do exactly the same
:%dele
call setline(1, lines)
exe "norm! 2Gf)l\<c-v>2jI: asdf\<esc>"
call assert_equal(expected, getline(1, 5))
:%dele
call setline(1, lines)
setlocal sw=8 noet
exe "norm! 2Gf)\<c-v>2jA: asdf\<esc>"
let expected =<< trim END
var d = {
a: (): asdf => 0,
b: (): asdf => 0,
c: (): asdf => 0,
}
END
call assert_equal(expected, getline(1, 5))
" insert on the next column should do exactly the same
:%dele
call setline(1, lines)
exe "norm! 2Gf)l\<c-v>2jI: asdf\<esc>"
call assert_equal(expected, getline(1, 5))
filetype off
bwipe!
endfunc
func Test_blockinsert_delete()
new
let _bs = &bs

View File

@@ -182,11 +182,12 @@ let s:filename_checks = {
\ 'fgl': ['file.4gl', 'file.4gh', 'file.m4gl'],
\ 'fish': ['file.fish'],
\ 'focexec': ['file.fex', 'file.focexec'],
\ 'forth': ['file.fs', 'file.ft', 'file.fth'],
\ 'forth': ['file.ft', 'file.fth'],
\ 'fortran': ['file.f', 'file.for', 'file.fortran', 'file.fpp', 'file.ftn', 'file.f77', 'file.f90', 'file.f95', 'file.f03', 'file.f08'],
\ 'fpcmake': ['file.fpc'],
\ 'framescript': ['file.fsl'],
\ 'freebasic': ['file.fb', 'file.bi'],
\ 'fs': ['file.fs'],
\ 'fstab': ['fstab', 'mtab'],
\ 'fvwm': ['/.fvwm/file', 'any/.fvwm/file'],
\ 'gdb': ['.gdbinit', 'gdbinit'],
@@ -554,7 +555,7 @@ let s:filename_checks = {
\ 'xhtml': ['file.xhtml', 'file.xht'],
\ 'xinetd': ['/etc/xinetd.conf', '/etc/xinetd.d/file', 'any/etc/xinetd.conf', 'any/etc/xinetd.d/file'],
\ 'xmath': ['file.msc', 'file.msf'],
\ 'xml': ['/etc/blkid.tab', '/etc/blkid.tab.old', 'file.xmi', 'file.csproj', 'file.csproj.user', 'file.ui', 'file.tpm', '/etc/xdg/menus/file.menu', 'fglrxrc', 'file.xlf', 'file.xliff', 'file.xul', 'file.wsdl', 'file.wpl', 'any/etc/blkid.tab', 'any/etc/blkid.tab.old', 'any/etc/xdg/menus/file.menu', 'file.atom', 'file.rss', 'file.cdxml', 'file.psc1', 'file.mpd'],
\ 'xml': ['/etc/blkid.tab', '/etc/blkid.tab.old', 'file.xmi', 'file.csproj', 'file.csproj.user', 'file.fsproj', 'file.fsproj.user', 'file.vbproj', 'file.vbproj.user', 'file.ui', 'file.tpm', '/etc/xdg/menus/file.menu', 'fglrxrc', 'file.xlf', 'file.xliff', 'file.xul', 'file.wsdl', 'file.wpl', 'any/etc/blkid.tab', 'any/etc/blkid.tab.old', 'any/etc/xdg/menus/file.menu', 'file.atom', 'file.rss', 'file.cdxml', 'file.psc1', 'file.mpd'],
\ 'xmodmap': ['anyXmodmap', 'Xmodmap', 'some-Xmodmap', 'some-xmodmap', 'some-xmodmap-file', 'xmodmap', 'xmodmap-file'],
\ 'xf86conf': ['xorg.conf', 'xorg.conf-4'],
\ 'xpm': ['file.xpm'],
@@ -664,6 +665,7 @@ let s:script_checks = {
\ 'fennel': [['#!/path/fennel']],
\ 'routeros': [['#!/path/rsc']],
\ 'fish': [['#!/path/fish']],
\ 'forth': [['#!/path/gforth']],
\ }
" Various forms of "env" optional arguments.
@@ -891,6 +893,16 @@ func Test_m_file()
call assert_equal('objc', &filetype)
bwipe!
call writefile(['#include <header.h>'], 'Xfile.m')
split Xfile.m
call assert_equal('objc', &filetype)
bwipe!
call writefile(['#define FORTY_TWO'], 'Xfile.m')
split Xfile.m
call assert_equal('objc', &filetype)
bwipe!
" Octave
call writefile(['# Octave line comment'], 'Xfile.m')
@@ -960,4 +972,57 @@ func Test_xpm_file()
filetype off
endfunc
func Test_fs_file()
filetype on
call writefile(['looks like F#'], 'Xfile.fs')
split Xfile.fs
call assert_equal('fs', &filetype)
bwipe!
let g:filetype_fs = 'forth'
split Xfile.fs
call assert_equal('forth', &filetype)
bwipe!
unlet g:filetype_fs
" Test dist#ft#FTfs()
" Forth (Gforth)
call writefile(['( Forth inline comment )'], 'Xfile.fs')
split Xfile.fs
call assert_equal('forth', &filetype)
bwipe!
call writefile(['.( Forth displayed inline comment )'], 'Xfile.fs')
split Xfile.fs
call assert_equal('forth', &filetype)
bwipe!
call writefile(['\ Forth line comment'], 'Xfile.fs')
split Xfile.fs
call assert_equal('forth', &filetype)
bwipe!
" empty line comment - no space required
call writefile(['\'], 'Xfile.fs')
split Xfile.fs
call assert_equal('forth', &filetype)
bwipe!
call writefile(['\G Forth documentation comment '], 'Xfile.fs')
split Xfile.fs
call assert_equal('forth', &filetype)
bwipe!
call writefile([': squared ( n -- n^2 )', 'dup * ;'], 'Xfile.fs')
split Xfile.fs
call assert_equal('forth', &filetype)
bwipe!
call delete('Xfile.fs')
filetype off
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -574,6 +574,13 @@ func Test_popup_drag()
endfunc
map <silent> <F5> :call test_setmouse(6, 21)<CR>
map <silent> <F6> :call test_setmouse(7, 25)<CR>
func ClickAndDrag()
call feedkeys("\<F7>\<LeftMouse>\<LeftRelease>", "xt")
call feedkeys("\<F8>\<LeftMouse>\<F9>\<LeftDrag>\<LeftRelease>", "xt")
endfunc
map <silent> <F7> :call test_setmouse(5, 2)<CR>
map <silent> <F8> :call test_setmouse(3, 14)<CR>
map <silent> <F9> :call test_setmouse(3, 18)<CR>
END
call writefile(lines, 'XtestPopupDrag')
let buf = RunVimInTerminal('-S XtestPopupDrag', #{rows: 10})
@@ -585,6 +592,10 @@ func Test_popup_drag()
call term_sendkeys(buf, ":call Resize()\<CR>")
call VerifyScreenDump(buf, 'Test_popupwin_drag_03', {})
" dragging works after click on a status line
call term_sendkeys(buf, ":call ClickAndDrag()\<CR>")
call VerifyScreenDump(buf, 'Test_popupwin_drag_04', {})
" clean up
call StopVimInTerminal(buf)
call delete('XtestPopupDrag')

View File

@@ -197,5 +197,18 @@ func Test_put_above_first_line()
bwipe!
endfunc
func Test_multibyte_op_end_mark()
new
call setline(1, 'тест')
normal viwdp
call assert_equal([0, 1, 7, 0], getpos("'>"))
call assert_equal([0, 1, 7, 0], getpos("']"))
normal Vyp
call assert_equal([0, 1, 2147483647, 0], getpos("'>"))
call assert_equal([0, 2, 7, 0], getpos("']"))
bwipe!
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -322,6 +322,16 @@ def Test_skipped_assignment()
CheckDefAndScriptSuccess(lines)
enddef
def Test_assign_keep_type()
var lines =<< trim END
vim9script
var l: list<number> = [123]
l = [123]
l->add('string')
END
CheckScriptFailure(lines, 'E1012:', 4)
enddef
def Test_assign_unpack()
var lines =<< trim END
var v1: number

View File

@@ -105,6 +105,23 @@ def Test_edit_wildcards()
var files = ['file 1', 'file%2', 'file# 3']
args `=files`
assert_equal(files, argv())
filename = 'Xwindo'
windo edit `=filename`
assert_equal('Xwindo', bufname())
filename = 'Xtabdo'
tabdo edit `=filename`
assert_equal('Xtabdo', bufname())
filename = 'Xargdo'
argdo edit `=filename`
assert_equal('Xargdo', bufname())
:%bwipe!
filename = 'Xbufdo'
bufdo file `=filename`
assert_equal('Xbufdo', bufname())
enddef
def Test_expand_alternate_file()

View File

@@ -757,6 +757,40 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
3689,
/**/
3688,
/**/
3687,
/**/
3686,
/**/
3685,
/**/
3684,
/**/
3683,
/**/
3682,
/**/
3681,
/**/
3680,
/**/
3679,
/**/
3678,
/**/
3677,
/**/
3676,
/**/
3675,
/**/
3674,
/**/
3673,
/**/
3672,
/**/

View File

@@ -999,35 +999,29 @@ find_typval_in_script(typval_T *dest)
*/
int
check_script_var_type(
typval_T *dest,
svar_T *sv,
typval_T *value,
char_u *name,
where_T where)
{
svar_T *sv = find_typval_in_script(dest);
int ret;
if (sv != NULL)
if (sv->sv_const != 0)
{
if (sv->sv_const != 0)
{
semsg(_(e_cannot_change_readonly_variable_str), name);
return FAIL;
}
ret = check_typval_type(sv->sv_type, value, where);
if (ret == OK && need_convert_to_bool(sv->sv_type, value))
{
int val = tv2bool(value);
clear_tv(value);
value->v_type = VAR_BOOL;
value->v_lock = 0;
value->vval.v_number = val ? VVAL_TRUE : VVAL_FALSE;
}
return ret;
semsg(_(e_cannot_change_readonly_variable_str), name);
return FAIL;
}
ret = check_typval_type(sv->sv_type, value, where);
if (ret == OK && need_convert_to_bool(sv->sv_type, value))
{
int val = tv2bool(value);
return OK; // not really
clear_tv(value);
value->v_type = VAR_BOOL;
value->v_lock = 0;
value->vval.v_number = val ? VVAL_TRUE : VVAL_FALSE;
}
return ret;
}
// words that cannot be used as a variable

View File

@@ -252,11 +252,13 @@ error_exit(int ret, char *msg)
exit(ret);
}
static void
exit_on_ferror(int c, FILE *fpi)
static int
getc_or_die(FILE *fpi)
{
int c = getc(fpi);
if (c == EOF && ferror(fpi))
perror_exit(2);
return c;
}
static void
@@ -311,8 +313,7 @@ parse_hex_digit(int c)
skip_to_eol(FILE *fpi, int c)
{
while (c != '\n' && c != EOF)
c = getc(fpi);
exit_on_ferror(c, fpi);
c = getc_or_die(fpi);
return c;
}
@@ -736,9 +737,8 @@ main(int argc, char *argv[])
long s = seekoff;
while (s--)
if ((c = getc(fp)) == EOF)
if ((c = getc_or_die(fp)) == EOF)
{
exit_on_ferror(c, fp);
error_exit(4, "sorry cannot seek.");
}
}
@@ -756,20 +756,19 @@ main(int argc, char *argv[])
p = 0;
c = 0;
while ((length < 0 || p < length) && (c = getc(fp)) != EOF)
while ((length < 0 || p < length) && (c = getc_or_die(fp)) != EOF)
{
fprintf_or_die(fpo, (hexx == hexxa) ? "%s0x%02x" : "%s0X%02X",
(p % cols) ? ", " : &",\n "[2*!p], c);
(p % cols) ? ", " : (!p ? " " : ",\n "), c);
p++;
}
exit_on_ferror(c, fp);
if (p)
fputs_or_die("\n", fpo);
fputs_or_die(&"};\n"[3 * (fp == stdin)], fpo);
if (fp != stdin)
{
fputs_or_die("};\n", fpo);
fprintf_or_die(fpo, "unsigned int %s", isdigit((int)argv[1][0]) ? "__" : "", 0);
for (e = 0; (c = argv[1][e]) != 0; e++)
putc_or_die(isalnum(c) ? CONDITIONAL_CAPITALIZE(c) : '_', fpo);
@@ -784,7 +783,7 @@ main(int argc, char *argv[])
{
p = cols;
e = 0;
while ((length < 0 || n < length) && (e = getc(fp)) != EOF)
while ((length < 0 || n < length) && (e = getc_or_die(fp)) != EOF)
{
putc_or_die(hexx[(e >> 4) & 0xf], fpo);
putc_or_die(hexx[e & 0xf], fpo);
@@ -795,7 +794,6 @@ main(int argc, char *argv[])
p = cols;
}
}
exit_on_ferror(e, fp);
if (p < cols)
putc_or_die('\n', fpo);
fclose_or_die(fp, fpo);
@@ -810,7 +808,7 @@ main(int argc, char *argv[])
grplen = 8 * octspergrp + 1;
e = 0;
while ((length < 0 || n < length) && (e = getc(fp)) != EOF)
while ((length < 0 || n < length) && (e = getc_or_die(fp)) != EOF)
{
int x;
@@ -856,7 +854,6 @@ main(int argc, char *argv[])
p = 0;
}
}
exit_on_ferror(e, fp);
if (p)
{
l[c] = '\n';