Compare commits

..

13 Commits

Author SHA1 Message Date
Bram Moolenaar
e468698994 patch 8.2.4792: indent operator creates an undo entry for every line
Problem:    Indent operator creates an undo entry for every line.
Solution:   Create one undo entry for all lines. (closes #10227)
2022-04-19 18:28:45 +01:00
Charlie Groves
fef4485ef5 patch 8.2.4791: events triggered in different order when reusing buffer
Problem:    Autocmd events triggered in different order when reusing an empty
            buffer.
Solution:   Call buff_freeall() earlier. (Charlie Groves, closes #10198)
2022-04-19 16:24:12 +01:00
Bram Moolenaar
c448e9c950 patch 8.2.4790: lilypond filetype not recognized
Problem:    Lilypond filetype not recognized.
Solution:   Add patterns for lilypond. (Doug Kearns)
2022-04-19 15:29:57 +01:00
Bram Moolenaar
a653e53b1f patch 8.2.4789: cursor pos wrong when using :redraw while editing the cmdline
Problem:    The cursor may be in the in wrong place when using :redraw while
            editing the cmdline.
Solution:   When editing the command line let :redraw update the command line
            too. (closes #10210)
2022-04-19 11:38:24 +01:00
Yegappan Lakshmanan
bac9a9e5c2 patch 8.2.4788: large payload for LSP message not tested
Problem:    Large payload for LSP message not tested.
Solution:   Add a test with a large LSP payload. (Yegappan Lakshmanan,
            closes #10223)
2022-04-19 10:25:13 +01:00
LemonBoy
9bd3ce22e3 patch 8.2.4787: prop_find() does not find the right property
Problem:    prop_find() does not find the right property.
Solution:   Fix the scan order. (closes #10220)
2022-04-18 21:54:02 +01:00
Bram Moolenaar
861fcee8de patch 8.2.4786: test for win_gotoid() in Visual mode fails on Mac
Problem:    Test for win_gotoid() in Visual mode fails on Mac.
Solution:   Skip the test on MacOS.
2022-04-18 19:16:55 +01:00
Bram Moolenaar
3aca0916f0 patch 8.2.4785: Visual mode not stopped if win_gotoid() goes to other buffer
Problem:    Visual mode not stopped early enough if win_gotoid() goes to
            another buffer. (Sergey Vlasov)
Solution:   Stop Visual mode before jumping to another buffer. (closes #10217)
2022-04-18 18:32:19 +01:00
Bram Moolenaar
1693712f02 patch 8.2.4784: lamba test with timer is flaky
Problem:    Lamba test with timer is flaky.
Solution:   Adjust sleep time on retry.
2022-04-18 16:14:10 +01:00
Bram Moolenaar
42ccb8d747 patch 8.2.4783: Coverity warns for leaking memory
Problem:    Coverity warns for leaking memory.
Solution:   Use another strategy freeing "theline".
2022-04-18 15:45:23 +01:00
Bram Moolenaar
75ab590f85 Update runtime files 2022-04-18 15:36:40 +01:00
Bram Moolenaar
a929c922b1 patch 8.2.4782: accessing freed memory
Problem:    Accessing freed memory.
Solution:   Clear evalarg after checking for trailing characters.
            (issue #10218)
2022-04-18 15:21:17 +01:00
Doron Behar
d0a20c9d11 patch 8.2.4781: Maxima files are not recognized
Problem:    Maxima files are not recognized.
Solution:   Add patterns to detect Maxima files. (Doron Behar, closes #10211)
2022-04-18 14:32:42 +01:00
54 changed files with 4649 additions and 3310 deletions

View File

@@ -3,7 +3,7 @@ vim9script
# Vim functions for file type detection
#
# Maintainer: Bram Moolenaar <Bram@vim.org>
# Last Change: 2022 Apr 06
# Last Change: 2022 Apr 13
# These functions are moved here from runtime/filetype.vim to make startup
# faster.

View File

@@ -1,4 +1,4 @@
*autocmd.txt* For Vim version 8.2. Last change: 2022 Apr 08
*autocmd.txt* For Vim version 8.2. Last change: 2022 Apr 17
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -95,6 +95,7 @@ Or use `:execute`: >
:augroup mine | exe "au! BufRead *" | augroup END
:augroup mine | exe "au BufRead * set tw=70" | augroup END
< *autocmd-expand*
Note that special characters (e.g., "%", "<cword>") in the ":autocmd"
arguments are not expanded when the autocommand is defined. These will be
expanded when the Event is recognized, and the {cmd} is executed. The only
@@ -473,13 +474,15 @@ BufRead or BufReadPost When starting to edit a new buffer, after
executing the modelines. See |BufWinEnter|
for when you need to do something after
processing the modelines.
This does NOT work for ":r file". Not used
when the file doesn't exist. Also used after
successfully recovering a file.
Also triggered for the filetypedetect group
when executing ":filetype detect" and when
writing an unnamed buffer in a way that the
buffer gets a name.
Also triggered:
- when writing an unnamed buffer in a way that
the buffer gets a name
- after successfully recovering a file
- for the filetypedetect group when executing
":filetype detect"
Not triggered:
- for the `:read file` command
- when the file doesn't exist
*BufReadCmd*
BufReadCmd Before starting to edit a new buffer. Should
read the file into the buffer. |Cmd-event|
@@ -707,9 +710,38 @@ CursorMoved After the cursor was moved in Normal or Visual
CursorMovedI After the cursor was moved in Insert mode.
Not triggered when the popup menu is visible.
Otherwise the same as CursorMoved.
*DiffUpdated*
DiffUpdated After diffs have been updated. Depending on
what kind of diff is being used (internal or
external) this can be triggered on every
change or when doing |:diffupdate|.
*DirChangedPre*
DirChangedPre The working directory is going to be changed,
as with |DirChanged|. The pattern is like
with |DirChanged|. The new directory can be
found in v:event.directory.
*DirChanged*
DirChanged The working directory has changed in response
to the |:cd| or |:tcd| or |:lcd| commands, or
as a result of the 'autochdir' option.
The pattern can be:
"window" to trigger on `:lcd`
"tabpage" to trigger on `:tcd`
"global" to trigger on `:cd`
"auto" to trigger on 'autochdir'.
"drop" to trigger on editing a file
<afile> is set to the new directory name.
*EncodingChanged*
EncodingChanged Fires off after the 'encoding' option has been
changed. Useful to set up fonts, for example.
*ExitPre*
ExitPre When using `:quit`, `:wq` in a way it makes
Vim exit, or using `:qall`, just after
|QuitPre|. Can be used to close any
non-essential window. Exiting may still be
cancelled if there is a modified buffer that
isn't automatically saved, use |VimLeavePre|
for really exiting.
*FileAppendCmd*
FileAppendCmd Before appending to a file. Should do the
appending to the file. Use the '[ and ']
@@ -737,35 +769,6 @@ FileChangedRO Before making the first change to a read-only
*E881*
If the number of lines changes saving for undo
may fail and the change will be aborted.
*DiffUpdated*
DiffUpdated After diffs have been updated. Depending on
what kind of diff is being used (internal or
external) this can be triggered on every
change or when doing |:diffupdate|.
*DirChangedPre*
DirChangedPre The working directory is going to be changed,
as with |DirChanged|. The pattern is like
with |DirChanged|. The new directory can be
found in v:event.directory.
*DirChanged*
DirChanged The working directory has changed in response
to the |:cd| or |:tcd| or |:lcd| commands, or
as a result of the 'autochdir' option.
The pattern can be:
"window" to trigger on `:lcd`
"tabpage" to trigger on `:tcd`
"global" to trigger on `:cd`
"auto" to trigger on 'autochdir'.
"drop" to trigger on editing a file
<afile> is set to the new directory name.
*ExitPre*
ExitPre When using `:quit`, `:wq` in a way it makes
Vim exit, or using `:qall`, just after
|QuitPre|. Can be used to close any
non-essential window. Exiting may still be
cancelled if there is a modified buffer that
isn't automatically saved, use |VimLeavePre|
for really exiting.
*FileChangedShell*
FileChangedShell When Vim notices that the modification time of
a file has changed since editing started.

View File

@@ -1,4 +1,4 @@
*builtin.txt* For Vim version 8.2. Last change: 2022 Apr 06
*builtin.txt* For Vim version 8.2. Last change: 2022 Apr 16
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -2046,7 +2046,7 @@ execute({command} [, {silent}]) *execute()*
It is not possible to use `:redir` anywhere in {command}.
To get a list of lines use |split()| on the result: >
split(execute('args'), "\n")
execute('args')->split("\n")
< To execute a command in another window than the current one
use `win_execute()`.
@@ -2237,6 +2237,8 @@ expand({string} [, {nosuf} [, {list}]]) *expand()*
a function
<SID> "<SNR>123_" where "123" is the
current script ID |<SID>|
<script> sourced script file, or script file
where the current function was defined
<stack> call stack
<cword> word under the cursor
<cWORD> WORD under the cursor

View File

@@ -614,9 +614,10 @@ attack or other people reading your file). When Vim exits the directory and
all files in it are deleted. When Vim has the setuid bit set this may cause
problems, the temp file is owned by the setuid user but the filter command
probably runs as the original user.
On MS-Windows the first of these directories that works is used: $TMP,
$TEMP, c:\TMP, c:\TEMP.
For Unix the list of directories is: $TMPDIR, /tmp, current-dir, $HOME.
Directory for temporary files is created in the first of these directories
that works:
Unix: $TMPDIR, /tmp, current-dir, $HOME.
Windows: $TMP, $TEMP, c:\TMP, c:\TEMP
For MS-Windows the GetTempFileName() system function is used.
For other systems the tmpnam() library function is used.

View File

@@ -1,4 +1,4 @@
*channel.txt* For Vim version 8.2. Last change: 2022 Apr 05
*channel.txt* For Vim version 8.2. Last change: 2022 Apr 16
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@@ -1,4 +1,4 @@
*cmdline.txt* For Vim version 8.2. Last change: 2022 Feb 04
*cmdline.txt* For Vim version 8.2. Last change: 2022 Apr 09
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@@ -1,4 +1,4 @@
*editing.txt* For Vim version 8.2. Last change: 2022 Apr 03
*editing.txt* For Vim version 8.2. Last change: 2022 Apr 16
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -445,7 +445,8 @@ does apply like to other wildcards.
Environment variables in the expression are expanded when evaluating the
expression, thus this works: >
:e `=$HOME .. '/.vimrc'`
This does not work, $HOME is inside a string and used literally: >
This uses $HOME inside a string and it will be used literally, most likely not
what you intended: >
:e `='$HOME' .. '/.vimrc'`
If the expression returns a string then names are to be separated with line
@@ -1694,7 +1695,7 @@ session or with another command (e.g., a filter command). Then you will know
which version of the file you want to keep.
The accuracy of the time check depends on the filesystem. On Unix it is
usually sub-second. With old file sytems and on MS-Windows it is normally one
usually sub-second. With old file systems and on MS-Windows it is normally one
second. Use `has('nanotime')` to check if sub-second time stamp checks are
available.

View File

@@ -1,4 +1,4 @@
*eval.txt* For Vim version 8.2. Last change: 2022 Apr 06
*eval.txt* For Vim version 8.2. Last change: 2022 Apr 17
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -4723,7 +4723,7 @@ parentheses can be cut out from |v:exception| with the ":substitute" command.
:
:try
:
: " something with arithmetics and I/O
: " something with arithmetic and I/O
:
:catch /^EXCEPT:MATHERR:RANGE/
: let function = substitute(v:exception, '.*(\(\a\+\)).*', '\1', "")

View File

@@ -1,4 +1,4 @@
*filetype.txt* For Vim version 8.2. Last change: 2022 Apr 07
*filetype.txt* For Vim version 8.2. Last change: 2022 Apr 09
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@@ -1,4 +1,4 @@
*map.txt* For Vim version 8.2. Last change: 2022 Apr 03
*map.txt* For Vim version 8.2. Last change: 2022 Apr 14
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1324,7 +1324,8 @@ underscore. Example: >
could define a mapping "<SNR>23_Add".
When defining a function in a script, "s:" can be prepended to the name to
make it local to the script. But when a mapping is executed from outside of
make it local to the script (in |Vim9| script functions without a prefix are
local to the script). But when a mapping is executed from outside of
the script, it doesn't know in which script the function was defined. To
avoid this problem, use "<SID>" instead of "s:". The same translation is done
as for mappings. This makes it possible to define a call to the function in

View File

@@ -1,4 +1,4 @@
*motion.txt* For Vim version 8.2. Last change: 2021 Dec 27
*motion.txt* For Vim version 8.2. Last change: 2022 Apr 18
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1078,7 +1078,7 @@ in the current file (an indent is removed and a long line is truncated to fit
in the window).
The marker ">" indicates the current position in the jumplist. It may not be
shown when filtering the |:jump| command using |:filter|
shown when filtering the |:jumps| command using |:filter|
You are currently in line 1167. If you then use the CTRL-O command, the
cursor is put in line 1154. This results in:

View File

@@ -1,4 +1,4 @@
*options.txt* For Vim version 8.2. Last change: 2022 Apr 07
*options.txt* For Vim version 8.2. Last change: 2022 Apr 13
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@@ -1,4 +1,4 @@
*starting.txt* For Vim version 8.2. Last change: 2022 Feb 01
*starting.txt* For Vim version 8.2. Last change: 2022 Apr 12
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@@ -215,7 +215,7 @@ A syntax group name doesn't specify any color or attributes itself.
The name for a highlight or syntax group must consist of ASCII letters, digits
and the underscore. As a regexp: "[a-zA-Z0-9_]*". However, Vim does not give
an error when using other characters. The maxium length of a group name is
an error when using other characters. The maximum length of a group name is
about 200 bytes. *E1249*
To be able to allow each user to pick their favorite set of colors, there must

View File

@@ -1457,6 +1457,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
--echo-wid starting.txt /*--echo-wid*
--help starting.txt /*--help*
--literal starting.txt /*--literal*
--log starting.txt /*--log*
--nofork starting.txt /*--nofork*
--noplugin starting.txt /*--noplugin*
--not-a-term starting.txt /*--not-a-term*
@@ -2003,6 +2004,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
:<cfile> cmdline.txt /*:<cfile>*
:<client> cmdline.txt /*:<client>*
:<cword> cmdline.txt /*:<cword>*
:<script> cmdline.txt /*:<script>*
:<sfile> cmdline.txt /*:<sfile>*
:<sflnum> cmdline.txt /*:<sflnum>*
:<slnum> cmdline.txt /*:<slnum>*
@@ -2082,6 +2084,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
:Termdebug terminal.txt /*:Termdebug*
:TermdebugCommand terminal.txt /*:TermdebugCommand*
:Texplore pi_netrw.txt /*:Texplore*
:Until terminal.txt /*:Until*
:UseVimball pi_vimball.txt /*:UseVimball*
:Vexplore pi_netrw.txt /*:Vexplore*
:VimballList pi_vimball.txt /*:VimballList*
@@ -3722,6 +3725,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
<range> map.txt /*<range>*
<reg> map.txt /*<reg>*
<register> map.txt /*<register>*
<script> cmdline.txt /*<script>*
<sfile> cmdline.txt /*<sfile>*
<sflnum> cmdline.txt /*<sflnum>*
<slnum> cmdline.txt /*<slnum>*
@@ -4057,7 +4061,6 @@ E1081 eval.txt /*E1081*
E1083 editing.txt /*E1083*
E1084 eval.txt /*E1084*
E1085 eval.txt /*E1085*
E1086 eval.txt /*E1086*
E1087 vim9.txt /*E1087*
E1089 eval.txt /*E1089*
E109 eval.txt /*E109*
@@ -4222,7 +4225,6 @@ E1231 map.txt /*E1231*
E1232 builtin.txt /*E1232*
E1233 builtin.txt /*E1233*
E1234 vim9.txt /*E1234*
E1235 vim9.txt /*E1235*
E1236 vim9.txt /*E1236*
E1237 map.txt /*E1237*
E1238 vim9.txt /*E1238*
@@ -4260,6 +4262,7 @@ E1266 if_pyth.txt /*E1266*
E127 eval.txt /*E127*
E1270 change.txt /*E1270*
E1271 vim9.txt /*E1271*
E1274 cmdline.txt /*E1274*
E128 eval.txt /*E128*
E129 eval.txt /*E129*
E13 message.txt /*E13*
@@ -4780,9 +4783,6 @@ E610 editing.txt /*E610*
E611 eval.txt /*E611*
E612 sign.txt /*E612*
E613 print.txt /*E613*
E614 editing.txt /*E614*
E615 editing.txt /*E615*
E616 editing.txt /*E616*
E617 options.txt /*E617*
E618 print.txt /*E618*
E619 print.txt /*E619*
@@ -5772,6 +5772,7 @@ autocmd-disable autocmd.txt /*autocmd-disable*
autocmd-events autocmd.txt /*autocmd-events*
autocmd-events-abc autocmd.txt /*autocmd-events-abc*
autocmd-execute autocmd.txt /*autocmd-execute*
autocmd-expand autocmd.txt /*autocmd-expand*
autocmd-groups autocmd.txt /*autocmd-groups*
autocmd-intro autocmd.txt /*autocmd-intro*
autocmd-list autocmd.txt /*autocmd-list*
@@ -6082,6 +6083,7 @@ channel-functions-details channel.txt /*channel-functions-details*
channel-mode channel.txt /*channel-mode*
channel-more channel.txt /*channel-more*
channel-noblock channel.txt /*channel-noblock*
channel-onetime-callback channel.txt /*channel-onetime-callback*
channel-open channel.txt /*channel-open*
channel-open-options channel.txt /*channel-open-options*
channel-raw channel.txt /*channel-raw*
@@ -7607,6 +7609,7 @@ hitest.vim syntax.txt /*hitest.vim*
hjkl usr_02.txt /*hjkl*
hl-ColorColumn syntax.txt /*hl-ColorColumn*
hl-Conceal syntax.txt /*hl-Conceal*
hl-CurSearch syntax.txt /*hl-CurSearch*
hl-Cursor syntax.txt /*hl-Cursor*
hl-CursorColumn syntax.txt /*hl-CursorColumn*
hl-CursorIM syntax.txt /*hl-CursorIM*

View File

@@ -1285,6 +1285,8 @@ Put focus on the gdb window to type commands there. Some common ones are:
- next execute the current line and stop at the next line
- step execute the current line and stop at the next statement,
entering functions
- until execute until past the current cursor line or past a specified
position or the current stack frame returns
- finish execute until leaving the current function
- where show the stack
- frame N go to the Nth stack frame
@@ -1303,6 +1305,7 @@ gdb:
*:Step* execute the gdb "step" command
*:Over* execute the gdb "next" command (`:Next` is a Vim command)
*:Until* execute the gdb "until" command
*:Finish* execute the gdb "finish" command
*:Continue* execute the gdb "continue" command
*:Stop* interrupt the program

View File

@@ -1,4 +1,4 @@
*todo.txt* For Vim version 8.2. Last change: 2022 Apr 06
*todo.txt* For Vim version 8.2. Last change: 2022 Apr 18
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -38,6 +38,8 @@ browser use: https://github.com/vim/vim/issues/1234
*known-bugs*
-------------------- Known bugs and current work -----------------------
Use "`=expr`" in heredoc also in :def function. #10216 Yegappan will do it.
Once Vim9 is stable:
- Use Vim9 for more runtime files.
- Check code coverage, add more tests if needed.
@@ -151,7 +153,6 @@ Terminal debugger:
- Add option to not open the program window. It's not used when attaching to
an already running program. (M. Kelly)
- When only gdb window exists, on "quit" edit another buffer.
- Use a sign group
- Termdebug does not work when Vim was built with mzscheme: gdb hangs just
after "run". Everything else works, including communication channel. Not
initializing mzscheme avoid the problem, thus it's not some #ifdef.
@@ -202,6 +203,11 @@ Terminal emulator window:
- When 'encoding' is not utf-8, or the job is using another encoding, setup
conversions.
CurSearch highlight is wrong when searching for a space, matches all spaces
instead of only the current one.
Can deref_func_name() and deref_function_name() be merged?
When using 'cryptmethod' xchaha20 the undo file is not encrypted.
Need to handle extra bytes.
@@ -223,8 +229,6 @@ 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.
Can "CSI nr X" be used instead of outputting spaces? Is it faster? #8002
@@ -255,6 +259,14 @@ Idea: when typing ":e /some/dir/" and "dir" does not exist, highlight in red.
initialization to figure out the default value from 'shell'. Add a test for
this.
With concealed text mouse click doesn't put the cursor in the right position.
(Herb Sitz) Fix by Christian Brabandt, 2011 Jun 16. Doesn't work properly,
need to make the change in where RET_WIN_BUF_CHARTABSIZE() is called.
IDEA: when drawing the text, store the text byte index in ScreenLinesIdx[].
When converting screen column to text position use this.
Store the line number and byte index for the start of the line, when
converting the screen line to text position use this, add the byte offset.
MS-Windows: did path modifier :p:8 stop working? #8600
Add support for "underdouble", "underdot" and "underdash". #9553
@@ -1920,10 +1932,6 @@ On MS-Windows a temp dir with a & init causes system() to fail. (Ben Fritz,
Patch 7.3.116 was the wrong solution.
Christian Brabandt has another incomplete patch. (2011 Jul 13)
With concealed text mouse click doesn't put the cursor in the right position.
(Herb Sitz) Fix by Christian Brabandt, 2011 Jun 16. Doesn't work properly,
need to make the change in where RET_WIN_BUF_CHARTABSIZE() is called.
Syntax region with 'concealends' and a 'cchar' value, 'conceallevel' set to 2,
only one of the two ends gets the cchar displayed. (Brett Stahlman, 2010 Aug
21, Ben Fritz, 2010 Sep 14)

View File

@@ -1,4 +1,4 @@
*vim9.txt* For Vim version 8.2. Last change: 2022 Mar 30
*vim9.txt* For Vim version 8.2. Last change: 2022 Apr 14
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@@ -1,7 +1,7 @@
" Vim support file to detect file types
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2022 Apr 07
" Last Change: 2022 Apr 13
" Listen very carefully, I will say this only once
if exists("did_load_filetypes")
@@ -158,6 +158,10 @@ au BufNewFile,BufRead *.asp
" Grub (must be before catch *.lst)
au BufNewFile,BufRead */boot/grub/menu.lst,*/boot/grub/grub.conf,*/etc/grub.conf setf grub
" Maxima, see:
" https://maxima.sourceforge.io/docs/manual/maxima_71.html#file_005ftype_005fmaxima
au BufNewFile,BufRead *.mc,*.demo,*.dem,*.dm{1,2,3,t},*.wxm,maxima-init.mac setf maxima
" Assembly (all kinds)
" *.lst is not pure assembly, it has two extra columns (address, byte codes)
au BufNewFile,BufRead *.asm,*.[sS],*.[aA],*.mac,*.lst call dist#ft#FTasm()
@@ -1013,6 +1017,9 @@ au BufNewFile,BufRead *.ll setf lifelines
" Lilo: Linux loader
au BufNewFile,BufRead lilo.conf setf lilo
" Lilypond
au BufNewFile,BufRead *.ly,*.ily setf lilypond
" Lisp (*.el = ELisp, *.cl = Common Lisp)
" *.jl was removed, it's also used for Julia, better skip than guess wrong.
if has("fname_case")

View File

@@ -31,7 +31,7 @@ Always use ":setlocal" to set 'indentexpr'. This avoids it being carried over
to other buffers.
To trigger the indenting after typing a word like "endif", add the word to the
'cinkeys' option with "+=".
'indentkeys' option with "+=".
You normally set 'indentexpr' to evaluate a function and then define that
function. That function only needs to be defined once for as long as Vim is

130
runtime/indent/krl.vim Normal file
View File

@@ -0,0 +1,130 @@
" Vim indent file
" Language: Kuka Robot Language
" Maintainer: Patrick Meiser-Knosowski <knosowski@graeffrobotics.de>
" Version: 3.0.0
" Last Change: 15. Apr 2022
" Credits: Based on indent/vim.vim
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal nolisp
setlocal nocindent
setlocal nosmartindent
setlocal autoindent
setlocal indentexpr=GetKrlIndent()
setlocal indentkeys=!^F,o,O,=~end,0=~else,0=~case,0=~default,0=~until,0=~continue,=~part
let b:undo_indent = "setlocal lisp< cindent< smartindent< autoindent< indentexpr< indentkeys<"
if get(g:,'krlSpaceIndent',1)
" Use spaces, not tabs, for indention, 2 is enough.
" More or even tabs would waste valuable space on the teach pendant.
setlocal softtabstop=2
setlocal shiftwidth=2
setlocal expandtab
setlocal shiftround
let b:undo_indent = b:undo_indent." softtabstop< shiftwidth< expandtab< shiftround<"
endif
" Only define the function once.
if exists("*GetKrlIndent")
finish
endif
let s:keepcpo = &cpo
set cpo&vim
function GetKrlIndent() abort
let currentLine = getline(v:lnum)
if currentLine =~? '\v^;(\s*(end)?fold>)@!' && !get(g:, 'krlCommentIndent', 0)
" If current line has a ; in column 1 and is no fold, keep zero 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 preNoneBlankLineNum = s:KrlPreNoneBlank(v:lnum - 1)
if preNoneBlankLineNum == 0
" At the start of the file use zero indent.
return 0
endif
let preNoneBlankLine = getline(preNoneBlankLineNum)
let ind = indent(preNoneBlankLineNum)
" Define add 'shiftwidth' pattern
let addShiftwidthPattern = '\v^\s*('
if get(g:, 'krlIndentBetweenDef', 1)
let addShiftwidthPattern ..= '(global\s+)?def(fct|dat)?\s+\$?\w'
let addShiftwidthPattern ..= '|'
endif
let addShiftwidthPattern ..= 'if>|while>|for>|loop>'
let addShiftwidthPattern ..= '|else>'
let addShiftwidthPattern ..= '|case>|default>'
let addShiftwidthPattern ..= '|repeat>'
let addShiftwidthPattern ..= '|skip>|(ptp_)?spline>'
let addShiftwidthPattern ..= '|time_block\s+(start|part)>'
let addShiftwidthPattern ..= '|const_vel\s+start>'
let addShiftwidthPattern ..= ')'
" Define Subtract 'shiftwidth' pattern
let subtractShiftwidthPattern = '\v^\s*('
if get(g:, 'krlIndentBetweenDef', 1)
let subtractShiftwidthPattern ..= 'end(fct|dat)?>'
let subtractShiftwidthPattern ..= '|'
endif
let subtractShiftwidthPattern ..= 'end(if|while|for|loop)>'
let subtractShiftwidthPattern ..= '|else>'
let subtractShiftwidthPattern ..= '|case>|default>|endswitch>'
let subtractShiftwidthPattern ..= '|until>'
let subtractShiftwidthPattern ..= '|end(skip|spline)>'
let subtractShiftwidthPattern ..= '|time_block\s+(part|end)>'
let subtractShiftwidthPattern ..= '|const_vel\s+end>'
let subtractShiftwidthPattern ..= ')'
" Add shiftwidth
if preNoneBlankLine =~? addShiftwidthPattern
let ind += &sw
endif
" Subtract shiftwidth
if currentLine =~? subtractShiftwidthPattern
let ind = ind - &sw
endif
" First case after a switch gets the indent of the switch.
if currentLine =~? '\v^\s*case>'
\&& preNoneBlankLine =~? '\v^\s*switch>'
let ind = ind + &sw
endif
" align continue with the following instruction
if currentLine =~? '\v^\s*continue>'
\&& getline(v:lnum + 1) =~? subtractShiftwidthPattern
let ind = ind - &sw
endif
return ind
endfunction
" This function works almost like prevnonblank() but handles &-headers,
" comments and continue instructions like blank lines
function s:KrlPreNoneBlank(lnum) abort
let nPreNoneBlank = prevnonblank(a:lnum)
while nPreNoneBlank > 0 && getline(nPreNoneBlank) =~? '\v^\s*(\&\w\+|;|continue>)'
" 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

View File

@@ -0,0 +1,148 @@
; vim: set ft=krl :
; START_INDENT
def One()
int i
If i==1 then
While i>=1
For i=1 to 5 step 2
Loop
i = i+1
EndLoop
EndFor
EndWhile
Else
Repeat
Switch i
Case 1
Skip 123
i = i+1
EndSkip 123
Spline with $acc=100, $vel.cp=3
slin {x 100}
scirc {x 110, y 110}, {x 120, y 90}
slin {x 200} c_dis
Time_Block Start
slin {x 300} c_dis
Time_Block Part = 22.2
slin {y 400} c_dis
Time_Block Part = 33.3
Time_Block End = 10
slin {y 200} c_dis
Const_Vel Start +100 OnStart
slin {y 300} c_dis
slin {x 100}
Const_Vel End -5.5
slin {y 200} c_dis
EndSpline
Case 2,3
PTP_Spline with $acc=100, $vel.ptp=100
sptp {a1 0} c_ptp
sptp {a1 90}
EndSpline c_spl
Default
i = i+1
EndSwitch
Continue
Until False
EndIf
end
DEF Two()
int i
END
global def Three()
int i
end
GLOBAL DEF Four()
int i
END
Global Def Five()
int i
End
deffct bool fOne()
int i
endfct
DEFFCT bool fTwo()
int i
ENDFCT
global deffct bool fThree()
int i
endfct
GLOBAL DEFFCT bool fFour()
int i
ENDFCT
Global DefFct bool fFive()
int i
EndFct
DefDat datfile()
global int i=1
; don't indent column 1 comments unless g:krlCommentIndent is set
; global int o=2
EndDat
; END_INDENT
; START_INDENT
; INDENT_EXE let g:krlSpaceIndent = 0
; INDENT_EXE set shiftwidth=4
def bla()
int i
end
; END_INDENT
; START_INDENT
; INDENT_EXE let g:krlCommentIndent = 1
def bla()
; indent this first column comment because of g:krlCommentIndent=1
end
; END_INDENT
; START_INDENT
; INDENT_EXE let g:krlIndentBetweenDef = 0
def bla()
int i ; don't indent this line because of g:krlIndentBetweenDef=0
end
; END_INDENT
; START_INDENT
; INDENT_AT this-line
def Some()
int f
if true then
f = 1 ; this-line
endif
end
; END_INDENT
; START_INDENT
; INDENT_NEXT next-line
def Some()
int i
; next-line
i = 1 ; should get indent of line 'int i' above
end
; END_INDENT
; START_INDENT
; INDENT_PREV prev-line
def Some()
int f
if true then
f = 1
; prev-line
endif
end
; END_INDENT

View File

@@ -0,0 +1,148 @@
; vim: set ft=krl :
; START_INDENT
def One()
int i
If i==1 then
While i>=1
For i=1 to 5 step 2
Loop
i = i+1
EndLoop
EndFor
EndWhile
Else
Repeat
Switch i
Case 1
Skip 123
i = i+1
EndSkip 123
Spline with $acc=100, $vel.cp=3
slin {x 100}
scirc {x 110, y 110}, {x 120, y 90}
slin {x 200} c_dis
Time_Block Start
slin {x 300} c_dis
Time_Block Part = 22.2
slin {y 400} c_dis
Time_Block Part = 33.3
Time_Block End = 10
slin {y 200} c_dis
Const_Vel Start +100 OnStart
slin {y 300} c_dis
slin {x 100}
Const_Vel End -5.5
slin {y 200} c_dis
EndSpline
Case 2,3
PTP_Spline with $acc=100, $vel.ptp=100
sptp {a1 0} c_ptp
sptp {a1 90}
EndSpline c_spl
Default
i = i+1
EndSwitch
Continue
Until False
EndIf
end
DEF Two()
int i
END
global def Three()
int i
end
GLOBAL DEF Four()
int i
END
Global Def Five()
int i
End
deffct bool fOne()
int i
endfct
DEFFCT bool fTwo()
int i
ENDFCT
global deffct bool fThree()
int i
endfct
GLOBAL DEFFCT bool fFour()
int i
ENDFCT
Global DefFct bool fFive()
int i
EndFct
DefDat datfile()
global int i=1
; don't indent column 1 comments unless g:krlCommentIndent is set
; global int o=2
EndDat
; END_INDENT
; START_INDENT
; INDENT_EXE let g:krlSpaceIndent = 0
; INDENT_EXE set shiftwidth=4
def bla()
int i
end
; END_INDENT
; START_INDENT
; INDENT_EXE let g:krlCommentIndent = 1
def bla()
; indent this first column comment because of g:krlCommentIndent=1
end
; END_INDENT
; START_INDENT
; INDENT_EXE let g:krlIndentBetweenDef = 0
def bla()
int i ; don't indent this line because of g:krlIndentBetweenDef=0
end
; END_INDENT
; START_INDENT
; INDENT_AT this-line
def Some()
int f
if true then
f = 1 ; this-line
endif
end
; END_INDENT
; START_INDENT
; INDENT_NEXT next-line
def Some()
int i
; next-line
i = 1 ; should get indent of line 'int i' above
end
; END_INDENT
; START_INDENT
; INDENT_PREV prev-line
def Some()
int f
if true then
f = 1
; prev-line
endif
end
; END_INDENT

View File

@@ -2,7 +2,7 @@
"
" Author: Bram Moolenaar
" Copyright: Vim license applies, see ":help license"
" Last Change: 2022 Jan 17
" Last Change: 2022 Apr 16
"
" WORK IN PROGRESS - The basics works stable, more to come
" Note: In general you need at least GDB 7.12 because this provides the
@@ -445,7 +445,7 @@ endfunc
func s:StartDebugCommon(dict)
" Sign used to highlight the line where the program has stopped.
" There can be only one.
sign define debugPC linehl=debugPC
call sign_define('debugPC', #{linehl: 'debugPC'})
" Install debugger commands in the text window.
call win_gotoid(s:sourcewin)
@@ -668,7 +668,9 @@ func s:EndDebugCommon()
endif
endif
endfor
exe was_buf .. "buf"
if bufexists(was_buf)
exe was_buf .. "buf"
endif
call s:DeleteCommands()
@@ -740,8 +742,8 @@ func s:HandleDisasmMsg(msg)
let lnum = search('^' . s:asm_addr)
if lnum != 0
exe 'sign unplace ' . s:asm_id
exe 'sign place ' . s:asm_id . ' line=' . lnum . ' name=debugPC'
call sign_unplace('TermDebug', #{id: s:asm_id})
call sign_place(s:asm_id, 'TermDebug', 'debugPC', '%', #{lnum: lnum})
endif
call win_gotoid(curwinid)
@@ -830,6 +832,7 @@ func s:InstallCommands()
command Clear call s:ClearBreakpoint()
command Step call s:SendResumingCommand('-exec-step')
command Over call s:SendResumingCommand('-exec-next')
command -nargs=? Until call s:Until(<q-args>)
command Finish call s:SendResumingCommand('-exec-finish')
command -nargs=* Run call s:Run(<q-args>)
command -nargs=* Arguments call s:SendResumingCommand('-exec-arguments ' . <q-args>)
@@ -866,7 +869,8 @@ func s:InstallCommands()
an 1.200 PopUp.-SEP3- <Nop>
an 1.210 PopUp.Set\ breakpoint :Break<CR>
an 1.220 PopUp.Clear\ breakpoint :Clear<CR>
an 1.230 PopUp.Evaluate :Evaluate<CR>
an 1.230 PopUp.Run\ until :Until<CR>
an 1.240 PopUp.Evaluate :Evaluate<CR>
endif
endif
@@ -894,6 +898,7 @@ func s:DeleteCommands()
delcommand Clear
delcommand Step
delcommand Over
delcommand Until
delcommand Finish
delcommand Run
delcommand Arguments
@@ -937,26 +942,35 @@ func s:DeleteCommands()
aunmenu PopUp.-SEP3-
aunmenu PopUp.Set\ breakpoint
aunmenu PopUp.Clear\ breakpoint
aunmenu PopUp.Run\ until
aunmenu PopUp.Evaluate
endif
endif
exe 'sign unplace ' . s:pc_id
for [id, entries] in items(s:breakpoints)
for subid in keys(entries)
exe 'sign unplace ' . s:Breakpoint2SignNumber(id, subid)
endfor
endfor
call sign_unplace('TermDebug')
unlet s:breakpoints
unlet s:breakpoint_locations
sign undefine debugPC
for val in s:BreakpointSigns
exe "sign undefine debugBreakpoint" . val
endfor
call sign_undefine('debugPC')
call sign_undefine(s:BreakpointSigns->map("'debugBreakpoint' .. v:val"))
let s:BreakpointSigns = []
endfunc
" :Until - Execute until past a specified position or current line
func s:Until(at)
if s:stopped
" reset s:stopped here, it may take a bit of time before we get a response
let s:stopped = 0
call ch_log('assume that program is running after this command')
" Use the fname:lnum format
let at = empty(a:at) ?
\ fnameescape(expand('%:p')) . ':' . line('.') : a:at
call s:SendCommand('-exec-until ' . at)
else
call ch_log('dropping command, program is running: exec-until')
endif
endfunc
" :Break - Set a breakpoint at the cursor position.
func s:SetBreakpoint(at)
" Setting a breakpoint may not work while the program is running.
@@ -990,7 +1004,8 @@ func s:ClearBreakpoint()
" Assume this always works, the reply is simply "^done".
call s:SendCommand('-break-delete ' . id)
for subid in keys(s:breakpoints[id])
exe 'sign unplace ' . s:Breakpoint2SignNumber(id, subid)
call sign_unplace('TermDebug',
\ #{id: s:Breakpoint2SignNumber(id, subid)})
endfor
unlet s:breakpoints[id]
unlet s:breakpoint_locations[bploc][idx]
@@ -1205,8 +1220,8 @@ func s:GotoAsmwinOrCreateIt()
call s:SendCommand('disassemble $pc')
endif
else
exe 'sign unplace ' . s:asm_id
exe 'sign place ' . s:asm_id . ' line=' . lnum . ' name=debugPC'
call sign_unplace('TermDebug', #{id: s:asm_id})
call sign_place(s:asm_id, 'TermDebug', 'debugPC', '%', #{lnum: lnum})
endif
endif
endfunc
@@ -1241,8 +1256,8 @@ func s:HandleCursor(msg)
if lnum == 0
call s:SendCommand('disassemble $pc')
else
exe 'sign unplace ' . s:asm_id
exe 'sign place ' . s:asm_id . ' line=' . lnum . ' name=debugPC'
call sign_unplace('TermDebug', #{id: s:asm_id})
call sign_place(s:asm_id, 'TermDebug', 'debugPC', '%', #{lnum: lnum})
endif
call win_gotoid(curwinid)
@@ -1279,8 +1294,9 @@ echomsg 'different fname: "' .. expand('%:p') .. '" vs "' .. fnamemodify(fname,
endif
exe lnum
normal! zv
exe 'sign unplace ' . s:pc_id
exe 'sign place ' . s:pc_id . ' line=' . lnum . ' name=debugPC priority=110 file=' . fname
call sign_unplace('TermDebug', #{id: s:pc_id})
call sign_place(s:pc_id, 'TermDebug', 'debugPC', fname,
\ #{lnum: lnum, priority: 110})
if !exists('b:save_signcolumn')
let b:save_signcolumn = &signcolumn
call add(s:signcolumn_buflist, bufnr())
@@ -1288,7 +1304,7 @@ echomsg 'different fname: "' .. expand('%:p') .. '" vs "' .. fnamemodify(fname,
setlocal signcolumn=yes
endif
elseif !s:stopped || fname != ''
exe 'sign unplace ' . s:pc_id
call sign_unplace('TermDebug', #{id: s:pc_id})
endif
call win_gotoid(wid)
@@ -1305,7 +1321,9 @@ func s:CreateBreakpoint(id, subid, enabled)
else
let hiName = "debugBreakpoint"
endif
exe "sign define debugBreakpoint" . nr . " text=" . substitute(nr, '\..*', '', '') . " texthl=" . hiName
call sign_define('debugBreakpoint' .. nr,
\ #{text: substitute(nr, '\..*', '', ''),
\ texthl: hiName})
endif
endfunc
@@ -1383,7 +1401,9 @@ endfunc
func s:PlaceSign(id, subid, entry)
let nr = printf('%d.%d', a:id, a:subid)
exe 'sign place ' . s:Breakpoint2SignNumber(a:id, a:subid) . ' line=' . a:entry['lnum'] . ' name=debugBreakpoint' . nr . ' priority=110 file=' . a:entry['fname']
call sign_place(s:Breakpoint2SignNumber(a:id, a:subid), 'TermDebug',
\ 'debugBreakpoint' .. nr, a:entry['fname'],
\ #{lnum: a:entry['lnum'], priority: 110})
let a:entry['placed'] = 1
endfunc
@@ -1397,7 +1417,8 @@ func s:HandleBreakpointDelete(msg)
if has_key(s:breakpoints, id)
for [subid, entry] in items(s:breakpoints[id])
if has_key(entry, 'placed')
exe 'sign unplace ' . s:Breakpoint2SignNumber(id, subid)
call sign_unplace('TermDebug',
\ #{id: s:Breakpoint2SignNumber(id, subid)})
unlet entry['placed']
endif
endfor

458
runtime/syntax/krl.vim Normal file
View File

@@ -0,0 +1,458 @@
" Vim syntax file
" Language: Kuka Robot Language
" Maintainer: Patrick Meiser-Knosowski <knosowski@graeffrobotics.de>
" Version: 3.0.0
" Last Change: 18. Apr 2022
" Credits: Thanks for contributions to this to Michael Jagusch
" Thanks for beta testing to Thomas Baginski
"
" Note to self:
" for testing perfomance
" open a 1000 lines file.
" :syntime on
" G
" hold down CTRL-U until reaching top
" :syntime report
" Init {{{
if exists("b:current_syntax")
finish
endif
let s:keepcpo = &cpo
set cpo&vim
" if colorscheme is tortus(less)? krlGroupName defaults to 1
if get(g:, 'colors_name', " ") =~ '\<tortus'
\&& !exists("g:krlGroupName")
let g:krlGroupName=1
endif
" krlGroupName defaults to 0 if it's not initialized yet or 0
if !get(g:, "krlGroupName", 0)
let g:krlGroupName = 0
endif
" krl does ignore case
syn case ignore
" take #, $ and & into keyword (syntax only)
syn iskeyword @,48-57,_,192-255,#,$,&
" spell checking
syn spell notoplevel
" }}} init
" Comment and Folding {{{
" Special Comment
" TODO Comment
syn keyword krlTodo contained TODO FIXME XXX
highlight default link krlTodo Todo
" Debug Comment
syn keyword krlDebug contained DEBUG
highlight default link krlDebug Debug
" Comment
" none move fold comment until second ;
syn match krlFoldComment /\c\v^\s*;\s*%(end)?fold>[^;]*/ containedin=krlFold contains=krlSingleQuoteString,krlInteger,krlFloat,krlMovement,krlDelimiter,krlBoolean
highlight default link krlFoldComment Comment
" move fold comment until second ;
syn match krlMoveFoldComment /\c\v^\s*;\s*fold>[^;]*<s?%(ptp|lin|circ|spl)(_rel)?>[^;]*/ containedin=krlFold contains=krlInteger,krlFloat,krlMovement,krlDelimiter
highlight default link krlMoveFoldComment Comment
" things to highlight in a fold line
syn keyword krlFoldHighlights CONT IN SYN OUT containedin=krlFoldComment
syn match krlFoldHighlights /\c\v<(M|F|E|A|t|i|bin|binin|UP|SPSMAKRO)\d+>/ containedin=krlFoldComment
if g:krlGroupName
highlight default link krlFoldHighlights Sysvars
else
" default color for Fold Highlights
endif
syn keyword krlVkrcFoldConstants EIN AUS containedin=krlFoldComment
highlight default link krlVkrcFoldConstants Boolean
" Comment without Fold, also includes endfold lines and fold line part after second ;
syn match krlComment /\c\v;\s*%(<%(end)?fold>)@!.*$/ containedin=krlFold contains=krlTodo,krlDebug,@Spell
" Commented out Fold line: "; ;FOLD PTP..."
syn match krlComment /\c\v^\s*;\s*;.*$/ contains=krlTodo,krlDebug
highlight default link krlComment Comment
if has("conceal") && get(g:, 'krlConcealFoldTail', 1)
syn match krlConcealFoldTail /\c\v(^\s*;\s*fold[^;]*)@250<=;%(--|\s*<fold>|\s*<endfold>)@!.*$/ transparent containedin=krlComment conceal cchar=*
endif
" }}} Comment and Folding
" Header {{{
syn match krlHeader /&\a\w*/
highlight default link krlHeader PreProc
" }}} Header
" Operator {{{
" Boolean operator
syn keyword krlBoolOperator and or exor not b_and b_or b_exor b_not
highlight default link krlBoolOperator Operator
" Arithmetic operator
syn match krlArithOperator /[+-]/ containedin=krlFloat
syn match krlArithOperator /[*/]/
highlight default link krlArithOperator Operator
" Compare operator
syn match krlCompOperator /[<>=]/
highlight default link krlCompOperator Operator
" Geometric operator
" Do not move the : operator
" Must be present befor krlParamdef
syn match krlGeomOperator /[:]/
" syn match krlGeomOperator /[:]/ containedin=krlLabel,krlParamdef
highlight default link krlGeomOperator Operator
" }}} Operator
" Type, StorageClass and Typedef {{{
" Simple data types
syn keyword krlType bool char real int containedin=krlAnyType
" External program and function
syn keyword krlType ext extfct extfctp extp containedin=krlAnyType
" Communication
syn keyword krlType signal channel containedin=krlAnyType
highlight default link krlType Type
" StorageClass
syn keyword krlStorageClass decl global const struc enum
highlight default link krlStorageClass StorageClass
" .dat file public
syn keyword krlDatStorageClass public
highlight default link krlDatStorageClass StorageClass
" Parameter StorageClass
" Do not move the :in/:out
" Must be present after krlGeomOperator
syn match krlParamdef /[:]\s*in\>/
syn match krlParamdef /[:]\s*out\>/
highlight default link krlParamdef StorageClass
" Not a typedef but I like to have those highlighted
" different then types, structures or strorage classes
syn keyword krlTypedef DEF DEFFCT ENDFCT DEFDAT ENDDAT
syn match krlTypedef /^\s*END\>/
highlight default link krlTypedef Typedef
" }}} Type, StorageClass and Typedef
" Delimiter {{{
syn match krlDelimiter /[\[\](),\\]/
highlight default link krlDelimiter Delimiter
" }}} Delimiter
" Constant values {{{
" Boolean
syn keyword krlBoolean true false containedin=krlStructVal
highlight default link krlBoolean Boolean
" Binary integer
syn match krlBinaryInt /'b[01]\+'/ containedin=krlStructVal
highlight default link krlBinaryInt Number
" Hexadecimal integer
syn match krlHexInt /'h[0-9a-fA-F]\+'/ containedin=krlStructVal
highlight default link krlHexInt Number
" Integer
syn match krlInteger /\W\@1<=[+-]\?\d\+/ containedin=krlStructVal,krlFloat contains=krlArithOperator
highlight default link krlInteger Number
" Float
syn match krlFloat /\v\W@1<=[+-]?\d+\.?\d*%(\s*[eE][+-]?\d+)?/ containedin=krlStructVal
highlight default link krlFloat Float
" String
syn region krlString start=/"/ end=/"/ oneline containedin=krlStructVal contains=@Spell
highlight default link krlString String
syn match krlSpecialChar /[|]/ containedin=krlString
highlight default link krlSpecialChar SpecialChar
" String within a fold line
syn region krlSingleQuoteString start=/'/ end=/'/ oneline contained contains=@Spell
highlight default link krlSingleQuoteString String
" Enum
syn match krlEnumVal /#\s*\a\w*/ containedin=krlStructVal
highlight default link krlEnumVal Constant
" }}} Constant values
" Predefined Structure and Enum {{{
" Predefined structures and enums found in
" /r1/mada/$*.dat, /r1/steu/$*.dat and
" /r1/system/$config.dat as well as
" basisTech, gripperTech and spotTech
"
" Predefined data types found in krc1
syn keyword krlStructure servopara keymove powermodul trace techangle tech techfct techcps techfctctrl axis_inc axis_cal date display_var pro_ip con bus
syn keyword krlEnum ident_state sig_state move_state async_state emt_mode boxmode msg_prm_typ msg_typ cmd_stat asys trace_state trace_mode direction techsys techgeoref techclass techmode hpu_key_val pro_state eax transsys mode_move cosys device rotsys emstop cause_t
"
" Predefined data types found in kss functions
syn keyword krlEnum ediagstate rdc_fs_state ret_c_psync_e var_type cancel_psync_e sys_vars
syn keyword krlStructure siginf rw_rdc_file rw_mam_file diagpar_t error_t stopmess case_sense_t msgbuf_t e3pos e3axis diagopt_t
"
" Predefined structures for movement
syn keyword krlStructure frame e6pos pos e6axis axis
syn keyword krlStructure fdat ldat pdat
syn keyword krlStructure load inertia
"
" Predefined structures for shapes
syn keyword krlStructure axbox cylinder box
"
" Predefined structures and enums found in /r1/mada/$machine.dat
syn keyword krlStructure cp fra acc_car jerk_struc dhart spin trpspin ex_kin et_ax maxtool
syn keyword krlEnum individual_mames supply_voltage kinclass main_axis wrist_axis sw_onoff
"
" Predefined structures and enums found in /r1/mada/$robcor.dat
" syn keyword krlStructure
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
"
" 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 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 krlEnum bas_command out_modetype ipo_m_t apo_mode_t funct_type p00_command timer_actiontype
"
" GripperTech
syn keyword krlStructure grp_typ grp_types grp_sugg_t
syn keyword krlEnum on_off_typ apo_typ
"
" SpotTech
syn keyword krlStructure spot_type spot_sugg_t
syn keyword krlEnum s_command s_pair_slct command_retr
"
" VW
syn keyword krlStructure vw_mpara_typ zangentyp zangenbedingung ibszangentyp last_ibs_typ verr_typ verrcheck_t t_fb_state kollisionsdaten state_t modus_t
syn keyword krlEnum synctype dir_typ subtype ari_typ bool_typ vw_command ibgn_command vw_user_cmd move_types adv_t_type bas_type ibs_mode_typ vw_user_cmd pro_mode mode_op
"
" ProgCoop
syn keyword krlStructure ydat
" syn keyword krlEnum
"
" bas.src
syn keyword krlStructure cont
syn keyword krlEnum esys ipo_mode circ_mode circ_type ori_type var_state
"
" MsgLib.src
syn keyword krlStructure KrlMsg_T KrlMsgParType_T KrlMsgPar_T KrlMsgOpt_T KrlMsgDlgSK_T
syn keyword krlEnum EKrlMsgType
"
highlight default link krlStructure Structure
highlight default link krlEnum Structure
" }}} Predefined Structure and Enum
" System variable {{{
syn match krlSysvars /\<\$\a[a-zA-Z0-9_.]*/
if g:krlGroupName
highlight default link krlSysvars Sysvars
else
" default color for Sysvars
endif
" }}} System variable
" Statements, keywords et al {{{
" continue
syn keyword krlContinue continue
if g:krlGroupName
highlight default link krlContinue Continue
else
highlight default link krlContinue Statement
endif
" interrupt
syn match krlStatement /\v\c%(<global>\s+)?<INTERRUPT>%(\s+<decl>)?/ contains=krlStorageClass
" keywords
syn keyword krlStatement wait on off enable disable stop trigger with when distance onstart delay do prio import is minimum maximum confirm on_error_proceed
syn match krlStatement /\v\c%(<wait\s+)@7<=<sec>/
syn match krlStatement /\v\c%(<when\s+)@7<=<path>/
highlight default link krlStatement Statement
" Conditional
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
highlight default link krlRepeat Repeat
" Label
syn keyword krlLabel goto
syn match krlLabel /^\s*\w\+:\ze\s*\%(;.*\)\?$/
highlight default link krlLabel Label
" Keyword
syn keyword krlKeyword anin anout digin
highlight default link krlKeyword Keyword
" Exception
syn keyword krlException return resume halt
highlight default link krlException Exception
" }}} Statements, keywords et al
" special keywords for movement commands {{{
syn keyword krlMovement PTP PTP_REL LIN LIN_REL CIRC CIRC_REL SPL SPL_REL SPTP SPTP_REL SLIN SLIN_REL SCIRC SCIRC_REL
syn keyword krlMovement ASYPTP ASYCONT ASYSTOP ASYCANCEL MOVE_EMI
syn match krlMovement /\v\c^\s*<BRAKE(\s+F)?>/
if g:krlGroupName
highlight default link krlMovement Movement
else
highlight default link krlMovement Special
endif
" movement modifiers
syn match krlMoveBlockInst /\c\v^\s*TIME_BLOCK\s+(START|PART|END)/
syn match krlMoveBlockInst /\c\v^\s*CONST_VEL\s+(START|END)/
syn keyword krlMoveBlockInst ptp_spline spline endspline
highlight default link krlMoveBlockInst Statement
syn keyword krlMoveMod ca c_ptp c_dis c_vel c_ori c_spl
if g:krlGroupName
highlight default link krlMoveMod Movement
else
highlight default link krlMoveMod Special
endif
" }}} special keywords for movement commands
" Structure value {{{
" avoid coloring structure component names
syn match krlNames /\.[a-zA-Z_][.a-zA-Z0-9_$]*/
syn match krlNames contained /[a-zA-Z_][.a-zA-Z0-9_$]*/
" highlight default link krlNames None
" Structure value
syn region krlStructVal start=/{/ end=/}/ oneline containedin=krlStructVal contains=krlNames
highlight default link krlStructVal Delimiter
" }}} Structure value
" BuildInFunction {{{
syn keyword krlBuildInFunction contained Pulse
syn keyword krlBuildInFunction contained m_comment
syn keyword krlBuildInFunction contained is_key_pressed
syn keyword krlBuildInFunction contained set_opt_filter
syn keyword krlBuildInFunction contained timer_limit
syn keyword krlBuildInFunction contained tool_adj
syn keyword krlBuildInFunction contained FRand
syn keyword krlBuildInFunction contained ExecFunc eb_test EB EK EO LK mbx_rec
" safe robot
syn keyword krlbuildinfunction contained get_AxesMask get_BrakeTest_Time
" math
syn keyword krlBuildInFunction contained Abs Sin Cos Acos Tan Atan Atan2 Sqrt
syn keyword krlBuildInFunction contained Forward Inverse inv_pos
" cFoo sFoo
syn keyword krlBuildInFunction contained cClose cOpen cRead cWrite sRead sWrite
" string
syn keyword krlBuildInFunction contained StrToBool StrToInt StrToReal StrToString StrToFrame StrToPos StrToE3Pos StrToE6Pos StrToAxis StrToE3Axis StrToE6Axis
syn keyword krlBuildInFunction contained StrAdd StrClear StrCopy StrComp StrFind StrLen StrDeclLen StrToBool StrToInt StrToReal StrToString
" diag
syn keyword krlBuildInFunction contained diag_start diag_stop get_DiagState
" rdc mam pid
syn keyword krlBuildInFunction contained CheckPidOnRdc check_mam_on_rdc get_rdc_fs_state
syn keyword krlBuildInFunction contained set_mam_on_hd copy_mam_hd_to_rdc copy_mam_rdc_to_hd
syn keyword krlBuildInFunction contained PidToHd PidToRdc
syn keyword krlBuildInFunction contained cal_to_rdc rdc_file_to_hd
syn keyword krlBuildInFunction contained delete_pid_on_rdc delete_rdc_content
syn keyword krlBuildInFunction contained create_rdc_archive restore_rdc_archive
" ioctl
syn keyword krlBuildInFunction contained IOCtl cIOCtl
syn keyword krlBuildInFunction contained WSpaceGive WSpaceTake
" sync
syn keyword krlBuildInFunction contained Sync SyncCmd CancelProgSync
" remote
syn keyword krlBuildInFunction contained RemoteCmd RemoteRead
" msg/dlg
syn keyword krlBuildInFunction contained IsMessageSet clear_KrlMsg get_MsgBuffer exists_KrlDlg exists_KrlMsg set_KrlDlg set_KrlDlgAnswer set_KrlMsg
" robvers
syn keyword krlBuildInFunction contained maximize_UsedxRobvers set_UsedxRobvers
" md_foo
syn keyword krlBuildInFunction contained md_Cmd md_GetState md_SetState md_Asgn
" emi
syn keyword krlBuildInFunction contained emi_ActPos emi_EndPos emi_StartPos emi_RecState emi_RecName
" var
syn keyword krlBuildInFunction contained cast_from cast_to
syn keyword krlBuildInFunction contained GetVarsize GetCycDef get_sig_inf get_decl_place VarType VarState
" sys
syn keyword krlBuildInFunction contained GetSysState get_system_data set_system_data set_system_data_delayed
" err
syn keyword krlBuildInFunction contained err_clear err_raise
" motion
syn keyword krlBuildInFunction contained delete_backward_buffer rob_stop rob_stop_release set_brake_delay suppress_repositioning VectorMoveOn VectorMoveOff
" torque
syn keyword krlBuildInFunction contained set_torque_limits reset_torque_limits
" krc1
syn keyword krlBuildInFunction contained cLcopy cCurpos cNew cClear cRelease cKey
if g:krlGroupName
highlight default link krlBuildInFunction BuildInFunction
else
highlight default link krlBuildInFunction Function
endif
" }}} BuildInFunction
" Function {{{
syn match krlFunction /[a-zA-Z_]\w* *(/me=e-1 contains=krlBuildInFunction
highlight default link krlFunction Function
" }}} Function
" Error {{{
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
"
" should be interrupt (on|off) \w+
syn match krlError1 /\vinterrupt[ \t(]+[_$a-zA-Z0-9]+[_$a-zA-Z0-9.\[\]()+\-*/]*[ \t)]+o%(n|ff)>/
"
" for bla==5 to 7...
" ||
syn match krlError3 /\v%(^\s*for%(\(|\s)+[_$a-zA-Z]+[_$a-zA-Z0-9.\[\]()+\-*/ ]*\s*)@<=[:=]\=/
"
" TODO optimize performance
" wait for a=b
" |
syn match krlError4 /\v%(^\s*%(return|wait\s+for|if|while|until|%(global\s+)?interrupt\s+decl)>[^;]+[^;<>=])@<=\=[^=]/
"
" wait for a><b
" ||
syn match krlError5 /\v%(^\s*%(return|wait\s+for|if|while|until|%(global\s+)?interrupt\s+decl)>[^;]+)@<=\>\s*\</
"
" if (a==5) (b==6) ...
" |||
syn match krlError6 /\v%(^\s*%(return|wait\s+for|if|while|until|%(global\s+)?interrupt\s+decl)>[^;]+[^;])@<=\)\s*\(/
"
" TODO optimize performance
" a == b + 1
" a := b + 1
" ||
syn match krlError7 /\v%(^\s*%(return|wait\s+for|if|while|until|%(global\s+)?interrupt\s+decl)>[^;]+[^;])@1<!%(^\s*[_$a-zA-Z]+[_$a-zA-Z0-9.\[\],+\-*/]*\s*)@<=[:=]\=/
syn match krlError7 /\v\c%(^\s*%(decl\s+)%(global\s+)?%(const\s+)?\w+\s+\w+\s*)@<=[:=]\=/
syn match krlError7 /\v\c%(^\s*%(decl\s+)?%(global\s+)?%(const\s+)?%(bool\s+|int\s+|real\s+|char\s+)\w+\s*)@<=[:=]\=/
"
" this one is tricky. Make sure this does not match trigger instructions; OK, next try, now search for false positives
" TODO optimize performance
" a = b and c or (int1=int2)
" |
syn match krlError8 /\v(^\s*[_$a-zA-Z]+[_$a-zA-Z0-9.\[\]()+\-*/]*\s*\=[^;]*[^;<>=])@<=\=\ze[^=]/
"
" <(distance|delay|prio)> :=
" <(distance|delay|prio)> ==
" ||
syn match krlError9 /\v(^[^;]*<(distance|delay|prio|minimum|maximum)\s*)@<=[:=]\=/
"
" 'for', 'while' or 'repeat' followed by 'do'
syn match krlError10 /\c\v^\s*(until|while|for)>[^;]*<do>/
"
highlight default link krlError0 Error
highlight default link krlError1 Error
highlight default link krlError2 Error
highlight default link krlError3 Error
highlight default link krlError4 Error
highlight default link krlError5 Error
highlight default link krlError6 Error
highlight default link krlError7 Error
highlight default link krlError8 Error
highlight default link krlError9 Error
highlight default link krlError10 Error
endif
" }}} Error
" Finish {{{
let &cpo = s:keepcpo
unlet s:keepcpo
let b:current_syntax = "krl"
" }}} Finish
" vim:sw=2 sts=2 et fdm=marker

129
runtime/syntax/openscad.vim Normal file
View File

@@ -0,0 +1,129 @@
" Vim syntax file
" Language: OpenSCAD
" Maintainer: Niklas Adam <adam@oddodd.org>
" Last change: 2022-04-15
"
"
" From salkin-mada/openscad.nvim
" Building on the work of Sirtaj Singh Kang and others for vim-openscad
"
" quit when a syntax file was already loaded
if exists("b:current_syntax")
finish
endif
syntax case ignore
setlocal iskeyword=a-z,A-Z,48-57,_
syn match openscadAoperator "{"
syn match openscadAoperator "}"
syn match openscadLi "\["
syn match openscadLi "\]"
syn match openscadPar "("
syn match openscadPar ")"
syn match openscadSpecialVariable "\$[a-zA-Z_]\+\>" display
syn match openscadModifier "^\s*[\*\!\#\%]" display
syn match openscadBinaryoperator "+"
syn match openscadBinaryoperator "-"
syn match openscadBinaryoperator "*"
syn match openscadBinaryoperator "/"
syn match openscadBinaryoperator "%"
syn match openscadBinaryoperator "\*\*"
syn match openscadBinaryoperator "<"
syn match openscadBinaryoperator "<="
syn match openscadBinaryoperator ">"
syn match openscadBinaryoperator ">="
syn match openscadBinaryoperator "="
syn match openscadBinaryoperator "=="
syn match openscadBinaryoperator "==="
syn match openscadBinaryoperator "!="
syn match openscadBinaryoperator "!=="
syn match openscadBinaryoperator "&"
syn match openscadBinaryoperator "|"
syn match openscadBinaryoperator "<!"
syn match openscadBinaryoperator "?"
syn match openscadBinaryoperator "??"
syn match openscadBinaryoperator "!?"
syn match openscadBinaryoperator "!"
syn match openscadBinaryoperator "#"
syn match openscadBinaryoperator "_"
syn match openscadBinaryoperator "\.\."
syn match openscadBinaryoperator "\.\.\."
syn match openscadBinaryoperator "`"
syn match openscadBinaryoperator ":"
syn keyword openscadFunctionDef function nextgroup=openscadFunction skipwhite skipempty
syn match openscadFunction /\<\h\w*\>/ contained display
syn keyword openscadModuleDef module nextgroup=openscadModule skipwhite skipempty
syn match openscadModule /\<\h\w*\>/ contained display
syn keyword openscadStatement echo assign let assert
syn keyword openscadConditional if else
syn keyword openscadRepeat for intersection_for
syn keyword openscadInclude include use
syn keyword openscadCsgKeyword union difference intersection render intersection_for
syn keyword openscadTransform scale rotate translate resize mirror multmatrix color minkowski hull projection linear_extrude rotate_extrude offset
syn keyword openscadPrimitiveSolid cube sphere cylinder polyhedron surface
syn keyword openscadPrimitive2D square circle polygon import_dxf text
syn keyword openscadPrimitiveImport import child children
syn match openscadNumbers "\<\d\|\.\d" contains=openscadNumber display transparent
syn match openscadNumber "\d\+" display contained
syn match openscadNumber "\.\d\+" display contained
syn region openscadString start=/"/ skip=/\\"/ end=/"/
syn keyword openscadBoolean true false
syn keyword openscadCommentTodo TODO FIXME XXX NOTE contained display
syn match openscadInlineComment ://.*$: contains=openscadCommentTodo
syn region openscadBlockComment start=:/\*: end=:\*/: fold contains=openscadCommentTodo
syn region openscadBlock start="{" end="}" transparent fold
syn region openscadVector start="\[" end="\]" transparent fold
syn keyword openscadBuiltin abs acos asin atan atan2 ceil cos exp floor ln log
syn keyword openscadBuiltin lookup max min pow rands round sign sin sqrt tan
syn keyword openscadBuiltin str len search version version_num concat chr ord cross norm
syn keyword openscadBuiltin parent_module
syn keyword openscadBuiltin dxf_cross dxf_dim
syn keyword openscadBuiltinSpecial PI undef
"""""""""""""""""""""""""""""""""""""""""
" linkage
"""""""""""""""""""""""""""""""""""""""""
hi def link openscadFunctionDef Structure
hi def link openscadAoperator Function
hi def link openscadLi Function
" hi def link openscadPar Structure
hi def link openscadBuiltinSpecial Special
hi def link openscadBinaryoperator Special
hi def link openscadFunction Function
hi def link openscadModuleDef Structure
hi def link openscadModule Function
hi def link openscadBlockComment Comment
hi def link openscadBoolean Boolean
hi def link openscadBuiltin Function
hi def link openscadConditional Conditional
hi def link openscadCsgKeyword Structure
hi def link openscadInclude Include
hi def link openscadInlineComment Comment
hi def link openscadModifier Special
hi def link openscadStatement Statement
hi def link openscadNumbers Number
hi def link openscadNumber Number
hi def link openscadPrimitiveSolid Keyword
hi def link openscadPrimitive2D Keyword
hi def link openscadPrimitiveImport Keyword
hi def link openscadRepeat Repeat
hi def link openscadSpecialVariable Special
hi def link openscadString String
hi def link openscadTransform Statement
hi def link openscadCommentTodo Todo
let b:current_syntax = 'openscad'

View File

@@ -1,6 +1,6 @@
" Vim syntax support file
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2020 Apr 13
" Last Change: 2022 Apr 12
" This file sets up for syntax highlighting.
" It is loaded from "syntax.vim" and "manual.vim".

View File

@@ -1,6 +1,6 @@
" Vim syntax support file
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2001 Sep 04
" Last Change: 2022 Apr 12
" This file is used for ":syntax on".
" It installs the autocommands and starts highlighting for all buffers.

View File

@@ -1,8 +1,8 @@
" Vim syntax file
" Language: Vim 8.2 script
" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
" Last Change: April 08, 2022
" Version: 8.2-33
" Last Change: April 10, 2022
" Version: 8.2-34
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM
" Automatically generated keyword lists: {{{1
@@ -74,7 +74,7 @@ syn keyword vimAutoEvent contained BufCreate BufEnter BufFilePre BufLeave BufNew
syn keyword vimGroup contained Comment Constant String Character Number Boolean Float Identifier Function Statement Conditional Repeat Label Operator Keyword Exception PreProc Include Define Macro PreCondit Type StorageClass Structure Typedef Special SpecialChar Tag Delimiter SpecialComment Debug Underlined Ignore Error Todo
" Default highlighting groups {{{2
syn keyword vimHLGroup contained ColorColumn Cursor CursorColumn CursorIM CursorLine CursorLineFold CursorLineNr CursorLineSign DiffAdd DiffChange DiffDelete DiffText Directory EndOfBuffer ErrorMsg FoldColumn Folded IncSearch LineNr LineNrAbove LineNrBelow MatchParen Menu ModeMsg MoreMsg NonText Normal Pmenu PmenuSbar PmenuSel PmenuThumb Question QuickFixLine Scrollbar Search SignColumn SpecialKey SpellBad SpellCap SpellLocal SpellRare StatusLine StatusLineNC StatusLineTerm TabLine TabLineFill TabLineSel Terminal Title Tooltip VertSplit Visual VisualNOS WarningMsg WildMenu
syn keyword vimHLGroup contained ColorColumn CurSearch Cursor CursorColumn CursorIM CursorLine CursorLineFold CursorLineNr CursorLineSign DiffAdd DiffChange DiffDelete DiffText Directory EndOfBuffer ErrorMsg FoldColumn Folded IncSearch LineNr LineNrAbove LineNrBelow MatchParen Menu ModeMsg MoreMsg NonText Normal Pmenu PmenuSbar PmenuSel PmenuThumb Question QuickFixLine Scrollbar Search SignColumn SpecialKey SpellBad SpellCap SpellLocal SpellRare StatusLine StatusLineNC StatusLineTerm TabLine TabLineFill TabLineSel Terminal Title Tooltip VertSplit Visual VisualNOS WarningMsg WildMenu
syn match vimHLGroup contained "Conceal"
syn case match

View File

@@ -2068,10 +2068,9 @@ buflist_new(
buf = curbuf;
// It's like this buffer is deleted. Watch out for autocommands that
// change curbuf! If that happens, allocate a new buffer anyway.
if (curbuf->b_p_bl)
apply_autocmds(EVENT_BUFDELETE, NULL, NULL, FALSE, curbuf);
if (buf == curbuf)
apply_autocmds(EVENT_BUFWIPEOUT, NULL, NULL, FALSE, curbuf);
buf_freeall(buf, BFA_WIPE | BFA_DEL);
if (buf != curbuf) // autocommands deleted the buffer!
return NULL;
#ifdef FEAT_EVAL
if (aborting()) // autocmds may abort script processing
{
@@ -2079,12 +2078,6 @@ buflist_new(
return NULL;
}
#endif
if (buf == curbuf)
{
// Make sure 'bufhidden' and 'buftype' are empty
clear_string_option(&buf->b_p_bh);
clear_string_option(&buf->b_p_bt);
}
}
if (buf != curbuf || curbuf == NULL)
{
@@ -2132,14 +2125,6 @@ buflist_new(
if (buf == curbuf)
{
// free all things allocated for this buffer
buf_freeall(buf, 0);
if (buf != curbuf) // autocommands deleted the buffer!
return NULL;
#if defined(FEAT_EVAL)
if (aborting()) // autocmds may abort script processing
return NULL;
#endif
free_buffer_stuff(buf, FALSE); // delete local variables et al.
// Init the options.

View File

@@ -2031,6 +2031,8 @@ channel_consume(channel_T *channel, ch_part_T part, int len)
* Collapses the first and second buffer for "channel"/"part".
* Returns FAIL if that is not possible.
* When "want_nl" is TRUE collapse more buffers until a NL is found.
* When the channel part mode is "lsp", collapse all the buffers as the http
* header and the JSON content can be present in multiple buffers.
*/
int
channel_collapse(channel_T *channel, ch_part_T part, int want_nl)

View File

@@ -684,7 +684,7 @@ eval_all_expr_in_str(char_u *str)
list_T *
heredoc_get(exarg_T *eap, char_u *cmd, int script_get)
{
char_u *theline;
char_u *theline = NULL;
char_u *marker;
list_T *l;
char_u *p;
@@ -776,6 +776,7 @@ heredoc_get(exarg_T *eap, char_u *cmd, int script_get)
int mi = 0;
int ti = 0;
vim_free(theline);
theline = eap->getline(NUL, eap->cookie, 0, FALSE);
if (theline == NULL)
{
@@ -789,18 +790,12 @@ heredoc_get(exarg_T *eap, char_u *cmd, int script_get)
&& STRNCMP(theline, *eap->cmdlinep, marker_indent_len) == 0)
mi = marker_indent_len;
if (STRCMP(marker, theline + mi) == 0)
{
vim_free(theline);
break;
}
// If expression evaluation failed in the heredoc, then skip till the
// end marker.
if (eval_failed)
{
vim_free(theline);
continue;
}
if (text_indent_len == -1 && *theline != NUL)
{
@@ -827,7 +822,6 @@ heredoc_get(exarg_T *eap, char_u *cmd, int script_get)
if (str == NULL)
{
// expression evaluation failed
vim_free(theline);
eval_failed = TRUE;
continue;
}
@@ -837,8 +831,8 @@ heredoc_get(exarg_T *eap, char_u *cmd, int script_get)
if (list_append_string(l, str, -1) == FAIL)
break;
vim_free(theline);
}
vim_free(theline);
vim_free(text_indent);
if (eval_failed)

View File

@@ -817,6 +817,9 @@ f_win_gotoid(typval_T *argvars, typval_T *rettv)
FOR_ALL_TAB_WINDOWS(tp, wp)
if (wp->w_id == id)
{
// When jumping to another buffer stop Visual mode.
if (VIsual_active && wp->w_buffer != curbuf)
end_visual_mode();
goto_tabpage_win(tp, wp);
rettv->vval.v_number = 1;
return;

View File

@@ -8323,6 +8323,10 @@ ex_redraw(exarg_T *eap)
// No need to wait after an intentional redraw.
need_wait_return = FALSE;
// When invoked from a callback or autocmd the command line may be active.
if (State & CMDLINE)
redrawcmdline();
out_flush();
}

View File

@@ -1060,40 +1060,44 @@ op_reindent(oparg_T *oap, int (*how)(void))
return;
}
for (i = oap->line_count; --i >= 0 && !got_int; )
{
// it's a slow thing to do, so give feedback so there's no worry that
// the computer's just hung.
if (i > 1
&& (i % 50 == 0 || i == oap->line_count - 1)
&& oap->line_count > p_report)
smsg(_("%ld lines to indent... "), i);
// Be vi-compatible: For lisp indenting the first line is not
// indented, unless there is only one line.
# ifdef FEAT_LISP
if (i != oap->line_count - 1 || oap->line_count == 1
|| how != get_lisp_indent)
# endif
// Save for undo. Do this once for all lines, much faster than doing this
// for each line separately, especially when undoing.
if (u_savecommon(start_lnum - 1, start_lnum + oap->line_count,
start_lnum + oap->line_count, FALSE) == OK)
for (i = oap->line_count; --i >= 0 && !got_int; )
{
l = skipwhite(ml_get_curline());
if (*l == NUL) // empty or blank line
amount = 0;
else
amount = how(); // get the indent for this line
// it's a slow thing to do, so give feedback so there's no worry
// that the computer's just hung.
if (amount >= 0 && set_indent(amount, SIN_UNDO))
if (i > 1
&& (i % 50 == 0 || i == oap->line_count - 1)
&& oap->line_count > p_report)
smsg(_("%ld lines to indent... "), i);
// Be vi-compatible: For lisp indenting the first line is not
// indented, unless there is only one line.
# ifdef FEAT_LISP
if (i != oap->line_count - 1 || oap->line_count == 1
|| how != get_lisp_indent)
# endif
{
// did change the indent, call changed_lines() later
if (first_changed == 0)
first_changed = curwin->w_cursor.lnum;
last_changed = curwin->w_cursor.lnum;
l = skipwhite(ml_get_curline());
if (*l == NUL) // empty or blank line
amount = 0;
else
amount = how(); // get the indent for this line
if (amount >= 0 && set_indent(amount, 0))
{
// did change the indent, call changed_lines() later
if (first_changed == 0)
first_changed = curwin->w_cursor.lnum;
last_changed = curwin->w_cursor.lnum;
}
}
++curwin->w_cursor.lnum;
curwin->w_cursor.col = 0; // make sure it's valid
}
++curwin->w_cursor.lnum;
curwin->w_cursor.col = 0; // make sure it's valid
}
// put cursor on first non-blank of indented line
curwin->w_cursor.lnum = start_lnum;

View File

@@ -2411,7 +2411,8 @@ mch_init_g(void)
* Otherwise the default "findstr /n" is used.
*/
if (!executable_exists("findstr.exe", NULL, TRUE, FALSE))
set_option_value((char_u *)"grepprg", 0, (char_u *)"grep -n", 0);
set_option_value_give_err((char_u *)"grepprg",
0, (char_u *)"grep -n", 0);
# ifdef FEAT_CLIPBOARD
win_clip_init();

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
| +0&#ffffff0@74
|~+0#4040ff13&| @73
|~| @73
|~| @73
|~| @73
|~| @73
|:+0#0000000&|f|o|r| |i| |i|n| |r|a|n|g|e|(|3|)| @56
|:| @1> @71

View File

@@ -0,0 +1,8 @@
| +0&#ffffff0@74
|~+0#4040ff13&| @73
|~| @73
|~| @73
|~| @73
|~| @73
|:+0#0000000&| @1|l|e|t| |i| |=> @64
@75

View File

@@ -0,0 +1,15 @@
|0+0&#ffffff0| @73
|1| @73
|2| @73
|3| @73
|4| @73
|[+1&&|N|o| |N|a|m|e|]| @47|1|,|1| @11|T|o|p
>2+0&&|1| @72
|2@1| @72
|2|3| @72
|2|4| @72
|2|5| @72
|2|6| @72
|[+3&&|N|o| |N|a|m|e|]| @47|1|,|1| @11|T|o|p
|r+0&&|e|g| |=| |"|f|o@1|"| @63
@75

View File

@@ -0,0 +1,15 @@
|0+0&#ffffff0| @73
|1| @73
|2| @73
|3| @73
|4| @73
|[+1&&|N|o| |N|a|m|e|]| @47|1|,|1| @11|T|o|p
|2+0&&|1| @72
|2@1| @72
|2+0&#e0e0e08>3+0&#ffffff0| @72
|2|4| @72
|2|5| @72
|2|6| @72
|[+3&&|N|o| |N|a|m|e|]| @47|3|,|2| @11|T|o|p
|r+0&&|e|g| |=| |"|2|3|"| @64
|-+2&&@1| |V|I|S|U|A|L| |-@1| +0&&@51|2| @9

View File

@@ -0,0 +1,15 @@
|0+0&#ffffff0| @73
|1| @73
>2| @73
|3| @73
|4| @73
|[+3&&|N|o| |N|a|m|e|]| @47|3|,|1| @11|T|o|p
|2+0&&|1| @72
|2@1| @72
|2|3| @72
|2|4| @72
|2|5| @72
|2|6| @72
|[+1&&|N|o| |N|a|m|e|]| @47|3|,|1| @11|T|o|p
|r+0&&|e|g| |=| |"|2|3|"| @64
@75

View File

@@ -3037,9 +3037,10 @@ func Test_autocmd_closing_cmdwin()
endfunc
func Test_autocmd_vimgrep()
%bwipe!
augroup aucmd_vimgrep
au QuickfixCmdPre,BufNew,BufDelete,BufReadCmd * sb
au QuickfixCmdPre,BufNew,BufDelete,BufReadCmd * q9
au QuickfixCmdPre,BufNew,BufReadCmd * sb
au QuickfixCmdPre,BufNew,BufReadCmd * q9
augroup END
%bwipe!
call assert_fails('lv ?a? foo', 'E926:')
@@ -3160,4 +3161,22 @@ func Test_v_event_readonly()
endfunc
func Test_noname_autocmd()
augroup test_noname_autocmd_group
autocmd!
autocmd BufEnter * call add(s:li, ["BufEnter", expand("<afile>")])
autocmd BufDelete * call add(s:li, ["BufDelete", expand("<afile>")])
autocmd BufLeave * call add(s:li, ["BufLeave", expand("<afile>")])
autocmd BufUnload * call add(s:li, ["BufUnload", expand("<afile>")])
autocmd BufWipeout * call add(s:li, ["BufWipeout", expand("<afile>")])
augroup END
let s:li = []
edit foo
call assert_equal([['BufUnload', ''], ['BufDelete', ''], ['BufWipeout', ''], ['BufEnter', 'foo']], s:li)
au! test_noname_autocmd_group
augroup! test_noname_autocmd_group
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -2466,7 +2466,7 @@ func LspOtCb(chan, msg)
endfunc
func LspTests(port)
" call ch_logfile('Xlsprpc.log', 'w')
" call ch_logfile('Xlspclient.log', 'w')
let ch = ch_open(s:localhost .. a:port, #{mode: 'lsp', callback: 'LspCb'})
if ch_status(ch) == "fail"
call assert_report("Can't open the lsp channel")
@@ -2620,6 +2620,16 @@ func LspTests(port)
" send a ping to make sure communication still works
call assert_equal('alive', ch_evalexpr(ch, #{method: 'ping'}).result)
" Test for a large payload
let content = repeat('abcdef', 11000)
let resp = ch_evalexpr(ch, #{method: 'large-payload',
\ params: #{text: content}})
call assert_equal(#{jsonrpc: '2.0', id: 26, result:
\ #{method: 'large-payload', jsonrpc: '2.0', id: 26,
\ params: #{text: content}}}, resp)
" send a ping to make sure communication still works
call assert_equal('alive', ch_evalexpr(ch, #{method: 'ping'}).result)
" Test for invoking an unsupported method
let resp = ch_evalexpr(ch, #{method: 'xyz', params: {}}, #{timeout: 200})
call assert_equal({}, resp)

View File

@@ -24,6 +24,11 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
def setup(self):
self.request.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
def debuglog(self, msg):
if self.debug:
with open("Xlspserver.log", "a") as myfile:
myfile.write(msg)
def send_lsp_msg(self, msgid, resp_dict):
v = {'jsonrpc': '2.0', 'result': resp_dict}
if msgid != -1:
@@ -34,8 +39,7 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
resp += "\r\n"
resp += s
if self.debug:
with open("Xlspdebug.log", "a") as myfile:
myfile.write("\n=> send\n" + resp)
self.debuglog("SEND: ({0} bytes) '{1}'\n".format(len(resp), resp))
self.request.sendall(resp.encode('utf-8'))
def send_wrong_payload(self):
@@ -136,6 +140,10 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
time.sleep(0.2)
self.send_lsp_msg(-1, 'wrong-payload')
def do_large_payload(self, payload):
# test for sending a large (> 64K) payload
self.send_lsp_msg(payload['id'], payload)
def do_rpc_resp_incorrect_id(self, payload):
self.send_lsp_msg(-1, 'rpc-resp-incorrect-id-1')
self.send_lsp_msg(-1, 'rpc-resp-incorrect-id-2')
@@ -185,8 +193,6 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
def process_msg(self, msg):
try:
decoded = json.loads(msg)
print("Decoded:")
print(str(decoded))
if 'method' in decoded:
test_map = {
'ping': self.do_ping,
@@ -194,6 +200,7 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
'simple-rpc': self.do_simple_rpc,
'rpc-with-notif': self.do_rpc_with_notif,
'wrong-payload': self.do_wrong_payload,
'large-payload': self.do_large_payload,
'rpc-resp-incorrect-id': self.do_rpc_resp_incorrect_id,
'simple-notif': self.do_simple_notif,
'multi-notif': self.do_multi_notif,
@@ -211,28 +218,40 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
if decoded['method'] in test_map:
test_map[decoded['method']](decoded)
else:
print("Error: Unsupported method: " + decoded['method'])
self.debuglog("Error: Unsupported method - " + decoded['method'] + "\n")
else:
print("Error: 'method' field is not found")
self.debuglog("Error: 'method' field is not found\n")
except ValueError:
print("json decoding failed")
self.debuglog("Error: json decoding failed\n")
def process_msgs(self, msgbuf):
while True:
sidx = msgbuf.find('Content-Length: ')
if sidx == -1:
# partial message received
return msgbuf
sidx += 16
eidx = msgbuf.find('\r\n')
if eidx == -1:
# partial message received
return msgbuf
msglen = int(msgbuf[sidx:eidx])
hdrend = msgbuf.find('\r\n\r\n')
if hdrend == -1:
# partial message received
return msgbuf
if msglen > len(msgbuf[hdrend + 4:]):
if self.debug:
self.debuglog("Partial message ({0} bytes)\n".format(len(msgbuf)))
# partial message received
return msgbuf
if self.debug:
self.debuglog("Complete message ({0} bytes) received\n".format(msglen))
# Remove the header
msgbuf = msgbuf[hdrend + 4:]
payload = msgbuf[:msglen]
@@ -243,27 +262,25 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
msgbuf = msgbuf[msglen:]
def handle(self):
print("=== socket opened ===")
self.debug = False
self.debuglog("=== socket opened ===\n")
msgbuf = ''
while True:
try:
received = self.request.recv(4096).decode('utf-8')
except socket.error:
print("=== socket error ===")
self.debuglog("=== socket error ===\n")
break
except IOError:
print("=== socket closed ===")
self.debuglog("=== socket closed ===\n")
break
if received == '':
print("=== socket closed ===")
self.debuglog("=== socket closed ===\n")
break
print("\nReceived:\n{0}".format(received))
# Write the received lines into the file for debugging
if self.debug:
with open("Xlspdebug.log", "a") as myfile:
myfile.write("\n<= recv\n" + received)
self.debuglog("RECV: ({0} bytes) '{1}'\n".format(len(received), received))
# Can receive more than one line in a response or a partial line.
# Accumulate all the received characters and process one line at
@@ -287,8 +304,6 @@ def main(host, port, server_class=ThreadedTCPServer):
if len(sys.argv) >= 2 and sys.argv[1] == 'delay':
port = 13684
writePortInFile(port)
print("Wait for it...")
time.sleep(0.5)
server = server_class((host, port), ThreadedTCPRequestHandler)
@@ -301,8 +316,6 @@ def main(host, port, server_class=ThreadedTCPServer):
writePortInFile(port)
print("Listening on port {0}".format(port))
# Main thread terminates, but the server continues running
# until server.shutdown() is called.
try:

View File

@@ -193,6 +193,28 @@ func Test_wildmenu_screendump()
call delete('XTest_wildmenu')
endfunc
func Test_redraw_in_autocmd()
CheckScreendump
let lines =<< trim END
set cmdheight=2
autocmd CmdlineChanged * redraw
END
call writefile(lines, 'XTest_redraw')
let buf = RunVimInTerminal('-S XTest_redraw', {'rows': 8})
call term_sendkeys(buf, ":for i in range(3)\<CR>")
call VerifyScreenDump(buf, 'Test_redraw_in_autocmd_1', {})
call term_sendkeys(buf, "let i =")
call VerifyScreenDump(buf, 'Test_redraw_in_autocmd_2', {})
" clean up
call term_sendkeys(buf, "\<CR>")
call StopVimInTerminal(buf)
call delete('XTest_redraw')
endfunc
func Test_map_completion()
call feedkeys(":map <unique> <si\<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"map <unique> <silent>', getreg(':'))

View File

@@ -306,6 +306,7 @@ let s:filename_checks = {
\ 'libao': ['/etc/libao.conf', '/.libao', 'any/.libao', 'any/etc/libao.conf'],
\ 'lifelines': ['file.ll'],
\ 'lilo': ['lilo.conf', 'lilo.conf-file'],
\ 'lilypond': ['file.ly', 'file.ily'],
\ 'limits': ['/etc/limits', '/etc/anylimits.conf', '/etc/anylimits.d/file.conf', '/etc/limits.conf', '/etc/limits.d/file.conf', '/etc/some-limits.conf', '/etc/some-limits.d/file.conf', 'any/etc/limits', 'any/etc/limits.conf', 'any/etc/limits.d/file.conf', 'any/etc/some-limits.conf', 'any/etc/some-limits.d/file.conf'],
\ 'liquid': ['file.liquid'],
\ 'lisp': ['file.lsp', 'file.lisp', 'file.asd', 'file.el', 'file.cl', '.emacs', '.sawfishrc', 'sbclrc', '.sbclrc'],
@@ -337,6 +338,8 @@ let s:filename_checks = {
\ 'markdown': ['file.markdown', 'file.mdown', 'file.mkd', 'file.mkdn', 'file.mdwn', 'file.md'],
\ 'mason': ['file.mason', 'file.mhtml', 'file.comp'],
\ 'master': ['file.mas', 'file.master'],
\ 'maxima': ['file.mc', 'file.demo', 'file.dem', 'file.dmt', 'file.dm1', 'file.dm2', 'file.dm3',
\ 'file.wxm', 'maxima-init.mac'],
\ 'mel': ['file.mel'],
\ 'meson': ['meson.build', 'meson_options.txt'],
\ 'messages': ['/log/auth', '/log/cron', '/log/daemon', '/log/debug', '/log/kern', '/log/lpr', '/log/mail', '/log/messages', '/log/news/news', '/log/syslog', '/log/user',

View File

@@ -59,6 +59,29 @@ func Test_reindent()
close!
endfunc
" Test indent operator creating one undo entry
func Test_indent_operator_undo()
enew
call setline(1, range(12)->map('"\t" .. v:val'))
func FoldExpr()
let g:foldcount += 1
return '='
endfunc
set foldmethod=expr foldexpr=FoldExpr()
let g:foldcount = 0
redraw
call assert_equal(12, g:foldcount)
normal gg=G
call assert_equal(24, g:foldcount)
undo
call assert_equal(38, g:foldcount)
bwipe!
set foldmethod& foldexpr=
delfunc FoldExpr
unlet g:foldcount
endfunc
" Test for shifting a line with a preprocessor directive ('#')
func Test_preproc_indent()
new

View File

@@ -1,6 +1,7 @@
" Test for lambda and closure
source check.vim
import './vim9.vim' as v9
func Test_lambda_feature()
call assert_equal(1, has('lambda'))
@@ -54,6 +55,23 @@ func Test_lambda_with_timer()
call assert_true(s:n > m)
endfunc
func Test_lambda_vim9cmd_linebreak()
CheckFeature timers
let g:test_is_flaky = 1
let lines =<< trim END
vim9cmd call timer_start(10, (x) => {
# comment
g:result = 'done'
})
END
call v9.CheckScriptSuccess(lines)
" sleep longer on a retry
exe 'sleep ' .. [20, 100, 500, 500, 500][g:run_nr] .. 'm'
call assert_equal('done', g:result)
unlet g:result
endfunc
func Test_lambda_with_partial()
let l:Cb = function({... -> ['zero', a:1, a:2, a:3]}, ['one', 'two'])
call assert_equal(['zero', 'one', 'two', 'three'], l:Cb('three'))

View File

@@ -1847,4 +1847,28 @@ func Test_prop_list()
call v9.CheckLegacyAndVim9Success(lines)
endfunc
func Test_prop_find_prev_on_same_line()
new
call setline(1, 'the quikc bronw fox jumsp over the layz dog')
call prop_type_add('misspell', #{highlight: 'ErrorMsg'})
for col in [8, 14, 24, 38]
call prop_add(1, col, #{type: 'misspell', length: 2})
endfor
call cursor(1,18)
let expected = [
\ #{lnum: 1, id: 0, col: 14, end: 1, type: 'misspell', type_bufnr: 0, length: 2, start: 1},
\ #{lnum: 1, id: 0, col: 24, end: 1, type: 'misspell', type_bufnr: 0, length: 2, start: 1}
\ ]
let result = prop_find(#{type: 'misspell'}, 'b')
call assert_equal(expected[0], result)
let result = prop_find(#{type: 'misspell'}, 'f')
call assert_equal(expected[1], result)
call prop_type_delete('misspell')
bwipe!
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -1,6 +1,7 @@
" Test using builtin functions in the Vim9 script language.
source check.vim
source screendump.vim
import './vim9.vim' as v9
" Test for passing too many or too few arguments to builtin functions
@@ -4493,6 +4494,47 @@ def Test_win_gotoid()
v9.CheckDefAndScriptFailure(['win_gotoid("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1'])
enddef
func Test_win_gotoid_in_mapping()
CheckScreendump
" requires a working clipboard and this doesn't work on MacOS
if has('clipboard_working') && !has('mac')
let @* = 'foo'
let lines =<< trim END
set cmdheight=2
func On_click()
call win_gotoid(getmousepos().winid)
execute "norm! \<LeftMouse>"
endfunc
noremap <LeftMouse> <Cmd>call On_click()<CR>
autocmd SafeState * echo 'reg = "' .. @* .. '"'
call setline(1, range(20))
set nomodified
botright new
call setline(1, range(21, 40))
set nomodified
func Click()
map <silent> <F3> :call test_setmouse(3, 1)<CR>
call feedkeys("\<F3>\<LeftMouse>\<LeftRelease>", "xt")
endfunc
END
call writefile(lines, 'Xgotoscript')
let buf = RunVimInTerminal('-S Xgotoscript', #{rows: 15, wait_for_ruler: 0})
call VerifyScreenDump(buf, 'Test_win_gotoid_1', {})
call term_sendkeys(buf, "3Gvl")
call VerifyScreenDump(buf, 'Test_win_gotoid_2', {})
call term_sendkeys(buf, ":call Click()\<CR>")
call VerifyScreenDump(buf, 'Test_win_gotoid_3', {})
call StopVimInTerminal(buf)
call delete('Xgotoscript')
endif
endfunc
def Test_win_id2tabwin()
v9.CheckDefAndScriptFailure(['win_id2tabwin("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1'])
enddef

View File

@@ -713,14 +713,14 @@ f_prop_find(typval_T *argvars, typval_T *rettv)
dictitem_T *di;
int lnum_start;
int start_pos_has_prop = 0;
int seen_end = 0;
int seen_end = FALSE;
int id = 0;
int id_found = FALSE;
int type_id = -1;
int skipstart = 0;
int skipstart = FALSE;
int lnum = -1;
int col = -1;
int dir = 1; // 1 = forward, -1 = backward
int dir = FORWARD; // FORWARD == 1, BACKWARD == -1
int both;
if (in_vim9script()
@@ -745,7 +745,7 @@ f_prop_find(typval_T *argvars, typval_T *rettv)
char_u *dir_s = tv_get_string(&argvars[1]);
if (*dir_s == 'b')
dir = -1;
dir = BACKWARD;
else if (*dir_s != 'f')
{
emsg(_(e_invalid_argument));
@@ -819,17 +819,19 @@ f_prop_find(typval_T *argvars, typval_T *rettv)
int prop_start;
int prop_end;
for (i = 0; i < count; ++i)
for (i = dir == BACKWARD ? count - 1 : 0; i >= 0 && i < count; i += dir)
{
mch_memmove(&prop, text + textlen + i * sizeof(textprop_T),
sizeof(textprop_T));
sizeof(textprop_T));
// For the very first line try to find the first property before or
// after `col`, depending on the search direction.
if (lnum == lnum_start)
{
if (dir < 0)
if (dir == BACKWARD)
{
if (col < prop.tp_col)
break;
if (prop.tp_col > col)
continue;
}
else if (prop.tp_col + prop.tp_len - (prop.tp_len != 0) < col)
continue;
@@ -845,9 +847,13 @@ f_prop_find(typval_T *argvars, typval_T *rettv)
- (prop.tp_len != 0)))
start_pos_has_prop = 1;
// The property was not continued from last line, it starts on
// this line.
prop_start = !(prop.tp_flags & TP_FLAG_CONT_PREV);
// The property does not continue on the next line, it ends on
// this line.
prop_end = !(prop.tp_flags & TP_FLAG_CONT_NEXT);
if (!prop_start && prop_end && dir > 0)
if (!prop_start && prop_end && dir == FORWARD)
seen_end = 1;
// Skip lines without the start flag.
@@ -856,7 +862,7 @@ f_prop_find(typval_T *argvars, typval_T *rettv)
// Always search backwards for start when search started
// on a prop and we're not skipping.
if (start_pos_has_prop && !skipstart)
dir = -1;
dir = BACKWARD;
continue;
}
@@ -887,8 +893,6 @@ f_prop_find(typval_T *argvars, typval_T *rettv)
break;
lnum--;
}
// Adjust col to indicate that we're continuing from prev/next line.
col = dir < 0 ? buf->b_ml.ml_line_len : 1;
}
}

View File

@@ -5529,7 +5529,6 @@ ex_call(exarg_T *eap)
}
if (eap->skip)
--emsg_skip;
clear_evalarg(&evalarg, eap);
// When inside :try we need to check for following "| catch" or "| endtry".
// Not when there was an error, but do check if an exception was thrown.
@@ -5549,6 +5548,8 @@ ex_call(exarg_T *eap)
else
set_nextcmd(eap, arg);
}
// Must be after using "arg", it may point into memory cleared here.
clear_evalarg(&evalarg, eap);
end:
dict_unref(fudi.fd_dict);

View File

@@ -746,6 +746,30 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
4792,
/**/
4791,
/**/
4790,
/**/
4789,
/**/
4788,
/**/
4787,
/**/
4786,
/**/
4785,
/**/
4784,
/**/
4783,
/**/
4782,
/**/
4781,
/**/
4780,
/**/