aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.git-blame-ignore-revs9
-rw-r--r--contrib/uncrustify.cfg2
-rw-r--r--runtime/compiler/spectral.vim17
-rw-r--r--runtime/compiler/yamllint.vim16
-rw-r--r--runtime/doc/api.txt100
-rw-r--r--runtime/doc/autocmd.txt6
-rw-r--r--runtime/doc/eval.txt86
-rw-r--r--runtime/doc/fold.txt2
-rw-r--r--runtime/doc/index.txt1
-rw-r--r--runtime/doc/insert.txt11
-rw-r--r--runtime/doc/options.txt1
-rw-r--r--runtime/doc/syntax.txt28
-rw-r--r--runtime/filetype.vim2
-rw-r--r--runtime/indent/bzl.vim41
-rw-r--r--runtime/indent/pascal.vim4
-rw-r--r--runtime/indent/testdir/xml.in2
-rw-r--r--runtime/indent/testdir/xml.ok2
-rw-r--r--runtime/pack/dist/opt/matchit/doc/matchit.txt4
-rw-r--r--runtime/syntax/aptconf.vim13
-rw-r--r--runtime/syntax/go.vim444
-rw-r--r--runtime/syntax/pascal.vim2
-rw-r--r--runtime/syntax/redif.vim4
-rw-r--r--runtime/syntax/vim.vim2
-rwxr-xr-xscripts/vim-patch.sh2
-rw-r--r--src/nvim/api/buffer.c17
-rw-r--r--src/nvim/api/ui_events.in.h3
-rw-r--r--src/nvim/api/vim.c8
-rw-r--r--src/nvim/edit.c58
-rw-r--r--src/nvim/po/tr.po759
-rw-r--r--src/nvim/syntax.c2169
-rw-r--r--src/nvim/testdir/test_ins_complete.vim127
-rw-r--r--src/nvim/window.c7
-rw-r--r--test/functional/ui/float_spec.lua79
-rw-r--r--test/functional/ui/multigrid_spec.lua28
-rw-r--r--test/functional/ui/screen.lua7
35 files changed, 2547 insertions, 1516 deletions
diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
index 00e7c7f3a5..d5e725e5c8 100644
--- a/.git-blame-ignore-revs
+++ b/.git-blame-ignore-revs
@@ -7,5 +7,14 @@
# save you the trouble of attempting this.
6c5bbf07d988ef55e5e8ba8d70b62c1f0885261b
+# symbol renames
+6186df3562e33e92f04ed8c850204ceabc4746e1
+
# style / uncrustify
2d240024acbd68c2d3f82bc72cb12b1a4928c6bf
+61178778230e609d68b271ffd53ffd993cd23c42
+15af08ad176339d1f269ce264bb0efea283c9536
+47f99d66440ae8be26b34531989ac61edc1ad9fe
+1e49a1c888a3d9a581f4aa409a26ada3ac2417cb
+3b3dbcf7b7ba5466e6ab643e256f2374b520a6b2
+e8067d1490a31ff76143d576dc9948b4f09c6c55
diff --git a/contrib/uncrustify.cfg b/contrib/uncrustify.cfg
index 93b64a30a5..567354600c 100644
--- a/contrib/uncrustify.cfg
+++ b/contrib/uncrustify.cfg
@@ -1,4 +1,4 @@
-# Uncrustify_d-0.73.0-159-81b1bc77
+# Uncrustify-0.73.0-159-81b1bc77
#
# General options
diff --git a/runtime/compiler/spectral.vim b/runtime/compiler/spectral.vim
new file mode 100644
index 0000000000..bd13c51f43
--- /dev/null
+++ b/runtime/compiler/spectral.vim
@@ -0,0 +1,17 @@
+" Vim compiler file
+" Compiler: Spectral for YAML
+" Maintainer: Romain Lafourcade <romainlafourcade@gmail.com>
+" Last Change: 2021 July 21
+
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "spectral"
+
+if exists(":CompilerSet") != 2
+ command -nargs=* CompilerSet setlocal <args>
+endif
+
+CompilerSet makeprg=spectral\ lint\ %\ -f\ text
+CompilerSet errorformat=%f:%l:%c\ %t%.%\\{-}\ %m
+
diff --git a/runtime/compiler/yamllint.vim b/runtime/compiler/yamllint.vim
new file mode 100644
index 0000000000..889b04b63c
--- /dev/null
+++ b/runtime/compiler/yamllint.vim
@@ -0,0 +1,16 @@
+" Vim compiler file
+" Compiler: Yamllint for YAML
+" Maintainer: Romain Lafourcade <romainlafourcade@gmail.com>
+" Last Change: 2021 July 21
+
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "yamllint"
+
+if exists(":CompilerSet") != 2
+ command -nargs=* CompilerSet setlocal <args>
+endif
+
+CompilerSet makeprg=yamllint\ -f\ parsable
+
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index dae7986fdb..df345e4981 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -134,6 +134,14 @@ lines, 0-based columns):
|nvim_win_get_cursor()|
|nvim_win_set_cursor()|
+Exception: the following API functions use |extmarks| indexing (0-based
+indices, end-inclusive):
+
+ |nvim_buf_del_extmark()|
+ |nvim_buf_get_extmark_by_id()|
+ |nvim_buf_get_extmarks()|
+ |nvim_buf_set_extmark()|
+
*api-fast*
Most API functions are "deferred": they are queued on the main loop and
processed sequentially with normal input. So if the editor is waiting for
@@ -436,36 +444,76 @@ Example: create a float with scratch buffer: >
>
==============================================================================
-Extended marks *api-extended-marks*
+Extended marks *api-extended-marks* *extmarks*
Extended marks (extmarks) represent buffer annotations that track text changes
-in the buffer. They could be used to represent cursors, folds, misspelled
-words, and anything else that needs to track a logical location in the buffer
-over time.
+in the buffer. They can represent cursors, folds, misspelled words, anything
+that needs to track a logical location in the buffer over time. |api-indexing|
+
+Extmark position works like "bar" cursor: it exists between characters. Thus
+the maximum extmark index on a line is 1 more than the character index: >
+
+ f o o b a r line contents
+ 0 1 2 3 4 5 character positions (0-based)
+ 0 1 2 3 4 5 6 extmark positions (0-based)
+
+Extmarks have "forward gravity": if you place the cursor directly on an
+extmark position and enter some text, the extmark migrates forward. >
+
+ f o o|b a r line (| = cursor)
+ 3 extmark
+
+ f o o z|b a r line (| = cursor)
+ 4 extmark (after typing "z")
+
+If an extmark is on the last index of a line and you inputsa newline at that
+point, the extmark will accordingly migrate to the next line: >
+
+ f o o z b a r| line (| = cursor)
+ 7 extmark
+
+ f o o z b a r first line
+ extmarks (none present)
+ | second line (| = cursor)
+ 0 extmark (after typing <CR>)
+
Example:
-We will set an extmark at the first row and third column. |api-indexing| is
-zero-indexed, so we use row=0 and column=2. Passing id=0 creates a new mark
-and returns the id: >
+Let's set an extmark at the first row (row=0) and third column (column=2).
+|api-indexing| Passing id=0 creates a new mark and returns the id: >
+ 01 2345678
+ 0 ex|ample..
+< ^ extmark position
+>
let g:mark_ns = nvim_create_namespace('myplugin')
- let g:mark_id = nvim_buf_set_extmark(0, g:mark_ns, 0, 0, 2, {})
-
-We can get a mark by its id: >
+ let g:mark_id = nvim_buf_set_extmark(0, g:mark_ns, 0, 2, {})
+<
+We can get the mark by its id: >
- echo nvim_buf_get_extmark_by_id(0, g:mark_ns, g:mark_id)
+ echo nvim_buf_get_extmark_by_id(0, g:mark_ns, g:mark_id, {})
=> [0, 2]
-We can get all marks in a buffer for our namespace (or by a range): >
+We can get all marks in a buffer by |namespace| (or by a range): >
echo nvim_buf_get_extmarks(0, g:mark_ns, 0, -1, {})
=> [[1, 0, 2]]
-Deleting all text surrounding an extmark does not remove the extmark. To
-remove an extmark use |nvim_buf_del_extmark()|.
+Deleting all surrounding text does NOT remove an extmark! To remove extmarks
+use |nvim_buf_del_extmark()|. Deleting "x" in our example: >
+
+ 0 12345678
+ 0 e|ample..
+< ^ extmark position
+>
+ echo nvim_buf_get_extmark_by_id(0, g:mark_ns, g:mark_id, {})
+ => [0, 1]
+<
+ Note: Extmark "gravity" decides how it will shift after a text edit.
+ See |nvim_buf_set_extmark()|
-Namespaces allow your plugin to manage only its own extmarks, ignoring those
+Namespaces allow any plugin to manage only its own extmarks, ignoring those
created by another plugin.
Extmark positions changed by an edit will be restored on undo/redo. Creating
@@ -779,10 +827,9 @@ nvim_feedkeys({keys}, {mode}, {escape_csi}) *nvim_feedkeys()*
On execution error: does not fail, but updates v:errmsg.
- If you need to input sequences like <C-o> use
- |nvim_replace_termcodes| to replace the termcodes and then
- pass the resulting string to nvim_feedkeys. You'll also want
- to enable escape_csi.
+ To input sequences like <C-o> use |nvim_replace_termcodes()|
+ (typically with escape_csi=true) to replace the keycodes. Then
+ pass the result to nvim_feedkeys().
Example: >
:let key = nvim_replace_termcodes("<C-o>", v:true, v:false, v:true)
@@ -2072,7 +2119,7 @@ nvim_buf_get_commands({buffer}, {opts}) *nvim_buf_get_commands()*
*nvim_buf_get_extmark_by_id()*
nvim_buf_get_extmark_by_id({buffer}, {ns_id}, {id}, {opts})
- Returns position for a given extmark id
+ Gets the position (0-indexed) of an extmark {id}.
Parameters: ~
{buffer} Buffer handle, or 0 for current buffer
@@ -2082,7 +2129,8 @@ nvim_buf_get_extmark_by_id({buffer}, {ns_id}, {id}, {opts})
• details: Whether to include the details dict
Return: ~
- (row, col) tuple or empty list () if extmark id was absent
+ 0-indexed (row, col) tuple or empty list () if extmark id
+ was absent
*nvim_buf_get_extmarks()*
nvim_buf_get_extmarks({buffer}, {ns_id}, {start}, {end}, {opts})
@@ -2122,10 +2170,12 @@ nvim_buf_get_extmarks({buffer}, {ns_id}, {start}, {end}, {opts})
Parameters: ~
{buffer} Buffer handle, or 0 for current buffer
{ns_id} Namespace id from |nvim_create_namespace()|
- {start} Start of range, given as (row, col) or valid
- extmark id (whose position defines the bound)
- {end} End of range, given as (row, col) or valid
- extmark id (whose position defines the bound)
+ {start} Start of range, given as 0-indexed (row, col) or
+ valid extmark id (whose position defines the
+ bound)
+ {end} End of range (inclusive), given as 0-indexed
+ (row, col) or valid extmark id (whose position
+ defines the bound)
{opts} Optional parameters. Keys:
• limit: Maximum number of marks to return
• details Whether to include the details dict
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt
index 960148d506..7a53f17a78 100644
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -499,8 +499,10 @@ CursorMoved After the cursor was moved in Normal or Visual
mode or to another window. Also when the text
of the cursor line has been changed, e.g. with
"x", "rx" or "p".
- Not triggered when there is typeahead or when
- an operator is pending.
+ Not triggered when there is typeahead, while
+ executing a script file, when an operator is
+ pending, or when moving to another window while
+ remaining at the same cursor position.
For an example see |match-parens|.
Note: Cannot be skipped with |:noautocmd|.
Careful: This is triggered very often, don't
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index d2e476b83b..def873a1da 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1318,7 +1318,17 @@ The lambda expression is also useful for jobs and timers: >
Handler called
Handler called
-Note how execute() is used to execute an Ex command. That's ugly though.
+Note that it is possible to cause memory to be used and not freed if the
+closure is referenced by the context it depends on: >
+ function Function()
+ let x = 0
+ let F = {-> x}
+ endfunction
+The closure uses "x" from the function scope, and "F" in that same scope
+refers to the closure. This cycle results in the memory not being freed.
+Recommendation: don't do this.
+
+Notice how execute() is used to execute an Ex command. That's ugly though.
Lambda expressions have internal names like '<lambda>42'. If you get an error
@@ -1723,7 +1733,8 @@ v:fcs_choice What should happen after a |FileChangedShell| event was
Vim behaves like it is empty, there is no warning message.
*v:fname* *fname-variable*
-v:fname The file name set by 'includeexpr'. Empty otherwise.
+v:fname When evaluating 'includeexpr': the file name that was
+ detected. Empty otherwise.
*v:fname_in* *fname_in-variable*
v:fname_in The name of the input file. Valid while evaluating:
@@ -2669,6 +2680,7 @@ append({lnum}, {text}) *append()*
Otherwise append {text} as one text line below line {lnum} in
the current buffer.
{lnum} can be zero to insert a line before the first one.
+ {lnum} is used like with |getline()|.
Returns 1 for failure ({lnum} out of range or out of memory),
0 for success. Example: >
:let failed = append(line('$'), "# THE END")
@@ -2874,8 +2886,9 @@ bufloaded({expr}) *bufloaded()*
let loaded = 'somename'->bufloaded()
bufname([{expr}]) *bufname()*
- The result is the name of a buffer, as it is displayed by the
- ":ls" command.
+ The result is the name of a buffer. Mostly as it is displayed
+ by the `:ls` command, but not using special names such as
+ "[No Name]".
If {expr} is omitted the current buffer is used.
If {expr} is a Number, that buffer number's name is given.
Number zero is the alternate buffer for the current window.
@@ -2908,7 +2921,7 @@ bufname([{expr}]) *bufname()*
*bufnr()*
bufnr([{expr} [, {create}]])
The result is the number of a buffer, as it is displayed by
- the ":ls" command. For the use of {expr}, see |bufname()|
+ the `:ls` command. For the use of {expr}, see |bufname()|
above.
If the buffer doesn't exist, -1 is returned. Or, if the
{create} argument is present and TRUE, a new, unlisted,
@@ -3087,10 +3100,10 @@ charidx({string}, {idx} [, {countcc}])
The index of the first character is zero.
If there are no multibyte characters the returned value is
equal to {idx}.
- When {countcc} is omitted or zero, then composing characters
- are not counted separately, their byte length is added to the
- preceding base character.
- When {countcc} is set to 1, then composing characters are
+ When {countcc} is omitted or |FALSE|, then composing characters
+ are not counted separately, their byte length is
+ added to the preceding base character.
+ When {countcc} is |TRUE|, then composing characters are
counted as separate characters.
Returns -1 if the arguments are invalid or if {idx} is greater
than the index of the last byte in {string}. An error is
@@ -3232,7 +3245,9 @@ complete_info([{what}])
See |complete-items|.
selected Selected item index. First index is zero.
Index is -1 if no item is selected (showing
- typed text only)
+ typed text only, or the last completion after
+ no item is selected when using the <Up> or
+ <Down> keys)
inserted Inserted string. [NOT IMPLEMENT YET]
*complete_info_mode*
@@ -4022,16 +4037,19 @@ filewritable({file}) *filewritable()*
filter({expr1}, {expr2}) *filter()*
- {expr1} must be a |List| or a |Dictionary|.
+ {expr1} must be a |List|, |Blob|, or a |Dictionary|.
For each item in {expr1} evaluate {expr2} and when the result
- is zero remove the item from the |List| or |Dictionary|.
+ is zero remove the item from the |List| or |Dictionary|. For a
+ |Blob| each byte is removed.
+
{expr2} must be a |string| or |Funcref|.
If {expr2} is a |string|, inside {expr2} |v:val| has the value
of the current item. For a |Dictionary| |v:key| has the key
of the current item and for a |List| |v:key| has the index of
- the current item.
- For a |Dictionary| |v:key| has the key of the current item.
+ the current item. For a |Blob| |v:key| has the index of the
+ current byte.
+
Examples: >
call filter(mylist, 'v:val !~ "OLD"')
< Removes the items where "OLD" appears. >
@@ -4062,11 +4080,11 @@ filter({expr1}, {expr2}) *filter()*
|Dictionary| to remain unmodified make a copy first: >
:let l = filter(copy(mylist), 'v:val =~ "KEEP"')
-< Returns {expr1}, the |List| or |Dictionary| that was filtered.
- When an error is encountered while evaluating {expr2} no
- further items in {expr1} are processed. When {expr2} is a
- Funcref errors inside a function are ignored, unless it was
- defined with the "abort" flag.
+< Returns {expr1}, the |List| , |Blob| or |Dictionary| that was
+ filtered. When an error is encountered while evaluating
+ {expr2} no further items in {expr1} are processed. When
+ {expr2} is a Funcref errors inside a function are ignored,
+ unless it was defined with the "abort" flag.
Can also be used as a |method|: >
mylist->filter(expr2)
@@ -6049,8 +6067,8 @@ line2byte({lnum}) *line2byte()*
line just below the last line: >
line2byte(line("$") + 1)
< This is the buffer size plus one. If 'fileencoding' is empty
- it is the file size plus one.
- When {lnum} is invalid -1 is returned.
+ it is the file size plus one. {lnum} is used like with
+ |getline()|. When {lnum} is invalid -1 is returned.
Also see |byte2line()|, |go| and |:goto|.
lispindent({lnum}) *lispindent()*
@@ -6116,7 +6134,8 @@ map({expr1}, {expr2}) *map()*
If {expr2} is a |string|, inside {expr2} |v:val| has the value
of the current item. For a |Dictionary| |v:key| has the key
of the current item and for a |List| |v:key| has the index of
- the current item.
+ the current item. For a |Blob| |v:key| has the index of the
+ current byte.
Example: >
:call map(mylist, '"> " . v:val . " <"')
< This puts "> " before and " <" after each item in "mylist".
@@ -6712,6 +6731,7 @@ nextnonblank({lnum}) *nextnonblank()*
if getline(nextnonblank(1)) =~ "Java"
< When {lnum} is invalid or there is no non-blank line at or
below it, zero is returned.
+ {lnum} is used like with |getline()|.
See also |prevnonblank()|.
nr2char({expr} [, {utf8}]) *nr2char()*
@@ -6791,6 +6811,7 @@ prevnonblank({lnum}) *prevnonblank()*
let ind = indent(prevnonblank(v:lnum - 1))
< When {lnum} is invalid or there is no non-blank line at or
above it, zero is returned.
+ {lnum} is used like with |getline()|.
Also see |nextnonblank()|.
@@ -7200,7 +7221,8 @@ reltimefloat({time}) *reltimefloat()*
call MyFunction()
let seconds = reltimefloat(reltime(start))
See the note of reltimestr() about overhead.
- Also see |profiling|.
+ Also see |profiling|.
+ If there is an error an empty string is returned
reltimestr({time}) *reltimestr()*
Return a String that represents the time value of {time}.
@@ -7214,6 +7236,7 @@ reltimestr({time}) *reltimestr()*
can use split() to remove it. >
echo split(reltimestr(reltime(start)))[0]
< Also see |profiling|.
+ If there is an error an empty string is returned
*remote_expr()* *E449*
remote_expr({server}, {string} [, {idvar} [, {timeout}]])
@@ -7458,6 +7481,10 @@ screenpos({winid}, {lnum}, {col}) *screenpos()*
The "curscol" value is where the cursor would be placed. For
a Tab it would be the same as "endcol", while for a double
width character it would be the same as "col".
+ The |conceal| feature is ignored here, the column numbers are
+ as if 'conceallevel' is zero. You can set the cursor to the
+ right position and use |screencol()| to get the value with
+ |conceal| taken into account.
screenrow() *screenrow()*
The result is a Number, which is the current screen row of the
@@ -8976,7 +9003,7 @@ synID({lnum}, {col}, {trans}) *synID()*
line. 'synmaxcol' applies, in a longer line zero is returned.
Note that when the position is after the last character,
that's where the cursor can be in Insert mode, synID() returns
- zero.
+ zero. {lnum} is used like with |getline()|.
When {trans} is |TRUE|, transparent items are reduced to the
item that they reveal. This is useful when wanting to know
@@ -9041,7 +9068,7 @@ synconcealed({lnum}, {col}) *synconcealed()*
The result is a |List| with currently three items:
1. The first item in the list is 0 if the character at the
position {lnum} and {col} is not part of a concealable
- region, 1 if it is.
+ region, 1 if it is. {lnum} is used like with |getline()|.
2. The second item in the list is a string. If the first item
is 1, the second item contains the text which will be
displayed in place of the concealed text, depending on the
@@ -9065,8 +9092,9 @@ synconcealed({lnum}, {col}) *synconcealed()*
synstack({lnum}, {col}) *synstack()*
Return a |List|, which is the stack of syntax items at the
- position {lnum} and {col} in the current window. Each item in
- the List is an ID like what |synID()| returns.
+ position {lnum} and {col} in the current window. {lnum} is
+ used like with |getline()|. Each item in the List is an ID
+ like what |synID()| returns.
The first item in the List is the outer region, following are
items contained in that one. The last one is what |synID()|
returns, unless not the whole item is highlighted or it is a
@@ -9663,7 +9691,7 @@ win_screenpos({nr}) *win_screenpos()*
[1, 1], unless there is a tabline, then it is [2, 1].
{nr} can be the window number or the |window-ID|. Use zero
for the current window.
- Return [0, 0] if the window cannot be found in the current
+ Returns [0, 0] if the window cannot be found in the current
tabpage.
win_splitmove({nr}, {target} [, {options}]) *win_splitmove()*
@@ -12036,7 +12064,7 @@ displayed.
*except-several-errors*
When several errors appear in a single command, the first error message is
-usually the most specific one and therefor converted to the error exception.
+usually the most specific one and therefore converted to the error exception.
Example: >
echo novar
causes >
diff --git a/runtime/doc/fold.txt b/runtime/doc/fold.txt
index 8e2cb2f728..80c934d13b 100644
--- a/runtime/doc/fold.txt
+++ b/runtime/doc/fold.txt
@@ -535,6 +535,8 @@ nest, the nested fold is one character right of the fold it's contained in.
A closed fold is indicated with a '+'.
+These characters can be changed with the 'fillchars' option.
+
Where the fold column is too narrow to display all nested folds, digits are
shown to indicate the nesting level.
diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt
index b69b294820..baa7bc1992 100644
--- a/runtime/doc/index.txt
+++ b/runtime/doc/index.txt
@@ -155,6 +155,7 @@ commands in CTRL-X submode *i_CTRL-X_index*
|i_CTRL-X_CTRL-Y| CTRL-X CTRL-Y scroll down
|i_CTRL-X_CTRL-U| CTRL-X CTRL-U complete with 'completefunc'
|i_CTRL-X_CTRL-V| CTRL-X CTRL-V complete like in : command line
+|i_CTRL-X_CTRL-Z| CTRL-X CTRL-Z stop completion, keeping the text as-is
|i_CTRL-X_CTRL-]| CTRL-X CTRL-] complete tags
|i_CTRL-X_s| CTRL-X s spelling suggestions
diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt
index bb00c77ca8..8f6de3e36f 100644
--- a/runtime/doc/insert.txt
+++ b/runtime/doc/insert.txt
@@ -622,6 +622,8 @@ Completion can be done for:
12. Spelling suggestions |i_CTRL-X_s|
13. keywords in 'complete' |i_CTRL-N| |i_CTRL-P|
+Additionally, |i_CTRL-X_CTRL-Z| stops completion without changing the text.
+
All these, except CTRL-N and CTRL-P, are done in CTRL-X mode. This is a
sub-mode of Insert and Replace modes. You enter CTRL-X mode by typing CTRL-X
and one of the CTRL-X commands. You exit CTRL-X mode by typing a key that is
@@ -1022,6 +1024,12 @@ CTRL-P Find previous match for words that start with the
other contexts unless a double CTRL-X is used.
+Stop completion *compl-stop*
+
+ *i_CTRL-X_CTRL-Z*
+CTRL-X CTRL-Z Stop completion without changing the text.
+
+
FUNCTIONS FOR FINDING COMPLETIONS *complete-functions*
This applies to 'completefunc' and 'omnifunc'.
@@ -1053,7 +1061,8 @@ On the second invocation the arguments are:
The function must return a List with the matching words. These matches
usually include the "a:base" text. When there are no matches return an empty
-List.
+List. Note that the cursor may have moved since the first invocation, the
+text may have been changed.
In order to return more information than the matching words, return a Dict
that contains the List. The Dict can have these items:
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index e2248e5d9a..c5678cf301 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -6749,6 +6749,7 @@ A jump table for the options with a short description can be found at |Q_op|.
The `g$` command will move to the end of the screen line.
It doesn't make sense to combine "all" with "onemore", but you will
not get a warning for it.
+ When combined with other words, "none" is ignored.
*'visualbell'* *'vb'* *'novisualbell'* *'novb'* *beep*
'visualbell' 'vb' boolean (default off)
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index a8d8d7d9b8..c6a9094792 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -887,7 +887,7 @@ For Visual Basic use: >
BAAN *baan.vim* *baan-syntax*
-The baan.vim gives syntax support for BaanC of release BaanIV upto SSA ERP LN
+The baan.vim gives syntax support for BaanC of release BaanIV up to SSA ERP LN
for both 3 GL and 4 GL programming. Large number of standard defines/constants
are supported.
@@ -1384,11 +1384,17 @@ To select syntax highlighting file for Euphoria, as well as for
auto-detecting the *.e and *.E file extensions as Euphoria file type,
add the following line to your startup file: >
- :let filetype_euphoria = "euphoria3"
+ :let g:filetype_euphoria = "euphoria3"
< or >
- :let filetype_euphoria = "euphoria4"
+ :let g:filetype_euphoria = "euphoria4"
+
+Elixir and Euphoria share the *.ex file extension. If the filetype is
+specifically set as Euphoria with the g:filetype_euphoria variable, or the
+file is determined to be Euphoria based on keywords in the file, then the
+filetype will be set as Euphoria. Otherwise, the filetype will default to
+Elixir.
ERLANG *erlang.vim* *ft-erlang-syntax*
@@ -1406,6 +1412,22 @@ To enable highlighting some special atoms, put this in your vimrc: >
:let g:erlang_highlight_special_atoms = 1
+ELIXIR *elixir.vim* *ft-elixir-syntax*
+
+Elixir is a dynamic, functional language for building scalable and maintainable
+applications.
+
+The following file extensions are auto-detected as Elixir file types:
+
+ *.ex, *.exs, *.eex, *.leex, *.lock
+
+Elixir and Euphoria share the *.ex file extension. If the filetype is
+specifically set as Euphoria with the g:filetype_euphoria variable, or the
+file is determined to be Euphoria based on keywords in the file, then the
+filetype will be set as Euphoria. Otherwise, the filetype will default to
+Elixir.
+
+
FLEXWIKI *flexwiki.vim* *ft-flexwiki-syntax*
FlexWiki is an ASP.NET-based wiki package available at http://www.flexwiki.com
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index c9eca870c2..7358f8f2b3 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -1,7 +1,7 @@
" Vim support file to detect file types
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2021 Jun 13
+" Last Change: 2021 Jul 03
" Listen very carefully, I will say this only once
if exists("did_load_filetypes")
diff --git a/runtime/indent/bzl.vim b/runtime/indent/bzl.vim
index 6904bfdedb..cf4cfb5fad 100644
--- a/runtime/indent/bzl.vim
+++ b/runtime/indent/bzl.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: Bazel (http://bazel.io)
" Maintainer: David Barnett (https://github.com/google/vim-ft-bzl)
-" Last Change: 2017 Jun 13
+" Last Change: 2021 Jul 08
if exists('b:did_indent')
finish
@@ -41,30 +41,41 @@ function GetBzlIndent(lnum) abort
if exists('g:pyindent_open_paren')
let l:pyindent_open_paren = g:pyindent_open_paren
endif
- let g:pyindent_nested_paren = 'shiftwidth() * 2'
- let g:pyindent_open_paren = 'shiftwidth() * 2'
+ let g:pyindent_nested_paren = 'shiftwidth()'
+ let g:pyindent_open_paren = 'shiftwidth()'
endif
let l:indent = -1
- " Indent inside parens.
- " Align with the open paren unless it is at the end of the line.
- " E.g.
- " open_paren_not_at_EOL(100,
- " (200,
- " 300),
- " 400)
- " open_paren_at_EOL(
- " 100, 200, 300, 400)
call cursor(a:lnum, 1)
let [l:par_line, l:par_col] = searchpairpos('(\|{\|\[', '', ')\|}\|\]', 'bW',
\ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" .
\ " synIDattr(synID(line('.'), col('.'), 1), 'name')" .
\ " =~ '\\(Comment\\|String\\)$'")
if l:par_line > 0
- call cursor(l:par_line, 1)
- if l:par_col != col('$') - 1
- let l:indent = l:par_col
+ " Indent inside parens.
+ if searchpair('(\|{\|\[', '', ')\|}\|\]', 'W',
+ \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" .
+ \ " synIDattr(synID(line('.'), col('.'), 1), 'name')" .
+ \ " =~ '\\(Comment\\|String\\)$'") && line('.') == a:lnum
+ " If cursor is at close parens, match indent with open parens.
+ " E.g.
+ " foo(
+ " )
+ let l:indent = indent(l:par_line)
+ else
+ " Align with the open paren unless it is at the end of the line.
+ " E.g.
+ " open_paren_not_at_EOL(100,
+ " (200,
+ " 300),
+ " 400)
+ " open_paren_at_EOL(
+ " 100, 200, 300, 400)
+ call cursor(l:par_line, 1)
+ if l:par_col != col('$') - 1
+ let l:indent = l:par_col
+ endif
endif
endif
diff --git a/runtime/indent/pascal.vim b/runtime/indent/pascal.vim
index c7955d669b..1f39fd1cad 100644
--- a/runtime/indent/pascal.vim
+++ b/runtime/indent/pascal.vim
@@ -2,7 +2,7 @@
" Language: Pascal
" Maintainer: Neil Carter <n.carter@swansea.ac.uk>
" Created: 2004 Jul 13
-" Last Change: 2017 Jun 13
+" Last Change: 2021 Jul 01
"
" This is version 2.0, a complete rewrite.
"
@@ -20,6 +20,8 @@ setlocal indentkeys+==end;,==const,==type,==var,==begin,==repeat,==until,==for
setlocal indentkeys+==program,==function,==procedure,==object,==private
setlocal indentkeys+==record,==if,==else,==case
+let b:undo_indent = "setl indentkeys< indentexpr<"
+
if exists("*GetPascalIndent")
finish
endif
diff --git a/runtime/indent/testdir/xml.in b/runtime/indent/testdir/xml.in
index b6333340e2..88ad51e484 100644
--- a/runtime/indent/testdir/xml.in
+++ b/runtime/indent/testdir/xml.in
@@ -15,7 +15,7 @@ text comment
</tag1>
<!--
text comment
-end coment -->
+end comment -->
</tag0>
<!-- END_INDENT -->
diff --git a/runtime/indent/testdir/xml.ok b/runtime/indent/testdir/xml.ok
index cfdf701c11..d5e2289cb3 100644
--- a/runtime/indent/testdir/xml.ok
+++ b/runtime/indent/testdir/xml.ok
@@ -15,7 +15,7 @@
</tag1>
<!--
text comment
- end coment -->
+ end comment -->
</tag0>
<!-- END_INDENT -->
diff --git a/runtime/pack/dist/opt/matchit/doc/matchit.txt b/runtime/pack/dist/opt/matchit/doc/matchit.txt
index 3cd2c8e2a7..58a47780ef 100644
--- a/runtime/pack/dist/opt/matchit/doc/matchit.txt
+++ b/runtime/pack/dist/opt/matchit/doc/matchit.txt
@@ -4,7 +4,7 @@ For instructions on installing this file, type
`:help matchit-install`
inside Vim.
-For Vim version 8.1. Last change: 2020 Mar 01
+For Vim version 8.1. Last change: 2021 May 17
VIM REFERENCE MANUAL by Benji Fisher et al
@@ -322,7 +322,7 @@ should work (and have the same effect as "foobar:barfoo:endfoobar"), although
this has not been thoroughly tested.
You can use |zero-width| patterns such as |\@<=| and |\zs|. (The latter has
-not been thouroughly tested in matchit.vim.) For example, if the keyword "if"
+not been thoroughly tested in matchit.vim.) For example, if the keyword "if"
must occur at the start of the line, with optional white space, you might use
the pattern "\(^\s*\)\@<=if" so that the cursor will end on the "i" instead of
at the start of the line. For another example, if HTML had only one tag then
diff --git a/runtime/syntax/aptconf.vim b/runtime/syntax/aptconf.vim
index 8cb14321e2..d51e7bdfa9 100644
--- a/runtime/syntax/aptconf.vim
+++ b/runtime/syntax/aptconf.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: APT config file
" Maintainer: Yann Amar <quidame@poivron.org>
-" Last Change: 2015 Dec 22
+" Last Change: 2021 Jul 12
" quit when a syntax file was already loaded
if !exists("main_syntax")
@@ -396,10 +396,13 @@ syn cluster aptconfSynaptic_ contains=aptconfSynaptic,
" }}}
" Unattended Upgrade: {{{
syn keyword aptconfUnattendedUpgrade contained
- \ AutoFixInterruptedDpkg Automatic-Reboot Automatic-Reboot-Time
- \ Automatic-Reboot-WithUsers InstallOnShutdown Mail MailOnlyOnError
- \ MinimalSteps Origins-Pattern Package-Blacklist
- \ Remove-Unused-Dependencies
+ \ Allow-APT-Mark-Fallback Allow-downgrade AutoFixInterruptedDpkg
+ \ Automatic-Reboot Automatic-Reboot-Time Automatic-Reboot-WithUsers
+ \ Debug InstallOnShutdown Mail MailOnlyOnError MailReport MinimalSteps
+ \ OnlyOnACPower Origins-Pattern Package-Blacklist
+ \ Remove-New-Unused-Dependencies Remove-Unused-Dependencies
+ \ Remove-Unused-Kernel-Packages Skip-Updates-On-Metered-Connections
+ \ SyslogEnable SyslogFacility Verbose
syn cluster aptconfUnattendedUpgrade_ contains=aptconfUnattendedUpgrade
" }}}
diff --git a/runtime/syntax/go.vim b/runtime/syntax/go.vim
index e78f8cf27c..1439487f69 100644
--- a/runtime/syntax/go.vim
+++ b/runtime/syntax/go.vim
@@ -1,58 +1,109 @@
-" Vim syntax file
-" Language: Go
-" Maintainer: David Barnett (https://github.com/google/vim-ft-go)
-" Last Change: 2014 Aug 16
-
-" Options:
-" There are some options for customizing the highlighting; the recommended
-" settings are the default values, but you can write:
-" let OPTION_NAME = 0
-" in your ~/.vimrc file to disable particular options. You can also write:
-" let OPTION_NAME = 1
-" to enable particular options. At present, all options default to on.
+" Copyright 2009 The Go Authors. All rights reserved.
+" Use of this source code is governed by a BSD-style
+" license that can be found in the LICENSE file.
"
-" - g:go_highlight_array_whitespace_error
-" Highlights white space after "[]".
-" - g:go_highlight_chan_whitespace_error
-" Highlights white space around the communications operator that don't
-" follow the standard style.
-" - g:go_highlight_extra_types
-" Highlights commonly used library types (io.Reader, etc.).
-" - g:go_highlight_space_tab_error
-" Highlights instances of tabs following spaces.
-" - g:go_highlight_trailing_whitespace_error
-" Highlights trailing white space.
+" go.vim: Vim syntax file for Go.
+" Language: Go
+" Maintainer: Billie Cleek <bhcleek@gmail.com>
+" Latest Revision: 2021-06-26
+" License: BSD-style. See LICENSE file in source repository.
+" Repository: https://github.com/fatih/vim-go
" Quit when a (custom) syntax file was already loaded
-if exists('b:current_syntax')
+if exists("b:current_syntax")
finish
endif
-if !exists('g:go_highlight_array_whitespace_error')
- let g:go_highlight_array_whitespace_error = 1
-endif
-if !exists('g:go_highlight_chan_whitespace_error')
- let g:go_highlight_chan_whitespace_error = 1
-endif
-if !exists('g:go_highlight_extra_types')
- let g:go_highlight_extra_types = 1
-endif
-if !exists('g:go_highlight_space_tab_error')
- let g:go_highlight_space_tab_error = 1
-endif
-if !exists('g:go_highlight_trailing_whitespace_error')
- let g:go_highlight_trailing_whitespace_error = 1
-endif
+let s:keepcpo = &cpo
+set cpo&vim
+
+function! s:FoldEnable(...) abort
+ if a:0 > 0
+ return index(s:FoldEnable(), a:1) > -1
+ endif
+ return get(g:, 'go_fold_enable', ['block', 'import', 'varconst', 'package_comment'])
+endfunction
+
+function! s:HighlightArrayWhitespaceError() abort
+ return get(g:, 'go_highlight_array_whitespace_error', 0)
+endfunction
+
+function! s:HighlightChanWhitespaceError() abort
+ return get(g:, 'go_highlight_chan_whitespace_error', 0)
+endfunction
+
+function! s:HighlightExtraTypes() abort
+ return get(g:, 'go_highlight_extra_types', 0)
+endfunction
+
+function! s:HighlightSpaceTabError() abort
+ return get(g:, 'go_highlight_space_tab_error', 0)
+endfunction
+
+function! s:HighlightTrailingWhitespaceError() abort
+ return get(g:, 'go_highlight_trailing_whitespace_error', 0)
+endfunction
+
+function! s:HighlightOperators() abort
+ return get(g:, 'go_highlight_operators', 0)
+endfunction
+
+function! s:HighlightFunctions() abort
+ return get(g:, 'go_highlight_functions', 0)
+endfunction
+
+function! s:HighlightFunctionParameters() abort
+ return get(g:, 'go_highlight_function_parameters', 0)
+endfunction
+
+function! s:HighlightFunctionCalls() abort
+ return get(g:, 'go_highlight_function_calls', 0)
+endfunction
+
+function! s:HighlightFields() abort
+ return get(g:, 'go_highlight_fields', 0)
+endfunction
+
+function! s:HighlightTypes() abort
+ return get(g:, 'go_highlight_types', 0)
+endfunction
+
+function! s:HighlightBuildConstraints() abort
+ return get(g:, 'go_highlight_build_constraints', 0)
+endfunction
+
+function! s:HighlightStringSpellcheck() abort
+ return get(g:, 'go_highlight_string_spellcheck', 1)
+endfunction
+
+function! s:HighlightFormatStrings() abort
+ return get(g:, 'go_highlight_format_strings', 1)
+endfunction
+
+function! s:HighlightGenerateTags() abort
+ return get(g:, 'go_highlight_generate_tags', 0)
+endfunction
+
+function! s:HighlightVariableAssignments() abort
+ return get(g:, 'go_highlight_variable_assignments', 0)
+endfunction
+
+function! s:HighlightVariableDeclarations() abort
+ return get(g:, 'go_highlight_variable_declarations', 0)
+endfunction
syn case match
-syn keyword goDirective package import
-syn keyword goDeclaration var const type
-syn keyword goDeclType struct interface
+syn keyword goPackage package
+syn keyword goImport import contained
+syn keyword goVar var contained
+syn keyword goConst const contained
-hi def link goDirective Statement
+hi def link goPackage Statement
+hi def link goImport Statement
+hi def link goVar Keyword
+hi def link goConst Keyword
hi def link goDeclaration Keyword
-hi def link goDeclType Keyword
" Keywords within functions
syn keyword goStatement defer go goto return break continue fallthrough
@@ -78,28 +129,38 @@ hi def link goUnsignedInts Type
hi def link goFloats Type
hi def link goComplexes Type
-" Treat func specially: it's a declaration at the start of a line, but a type
-" elsewhere. Order matters here.
-syn match goType /\<func\>/
-syn match goDeclaration /^func\>/
-
" Predefined functions and values
-syn keyword goBuiltins append cap close complex copy delete imag len
-syn keyword goBuiltins make new panic print println real recover
-syn keyword goConstants iota true false nil
+syn keyword goBuiltins append cap close complex copy delete imag len
+syn keyword goBuiltins make new panic print println real recover
+syn keyword goBoolean true false
+syn keyword goPredefinedIdentifiers nil iota
-hi def link goBuiltins Keyword
-hi def link goConstants Keyword
+hi def link goBuiltins Identifier
+hi def link goBoolean Boolean
+hi def link goPredefinedIdentifiers goBoolean
" Comments; their contents
syn keyword goTodo contained TODO FIXME XXX BUG
syn cluster goCommentGroup contains=goTodo
-syn region goComment start="/\*" end="\*/" contains=@goCommentGroup,@Spell
-syn region goComment start="//" end="$" contains=@goCommentGroup,@Spell
+
+syn region goComment start="//" end="$" contains=goGenerate,@goCommentGroup,@Spell
+if s:FoldEnable('comment')
+ syn region goComment start="/\*" end="\*/" contains=@goCommentGroup,@Spell fold
+ syn match goComment "\v(^\s*//.*\n)+" contains=goGenerate,@goCommentGroup,@Spell fold
+else
+ syn region goComment start="/\*" end="\*/" contains=@goCommentGroup,@Spell
+endif
hi def link goComment Comment
hi def link goTodo Todo
+if s:HighlightGenerateTags()
+ syn match goGenerateVariables contained /\%(\$GOARCH\|\$GOOS\|\$GOFILE\|\$GOLINE\|\$GOPACKAGE\|\$DOLLAR\)\>/
+ syn region goGenerate start="^\s*//go:generate" end="$" contains=goGenerateVariables
+ hi def link goGenerate PreProc
+ hi def link goGenerateVariables Special
+endif
+
" Go escapes
syn match goEscapeOctal display contained "\\[0-7]\{3}"
syn match goEscapeC display contained +\\[abfnrtv\\'"]+
@@ -118,8 +179,30 @@ hi def link goEscapeError Error
" Strings and their contents
syn cluster goStringGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU,goEscapeError
-syn region goString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@goStringGroup
-syn region goRawString start=+`+ end=+`+
+if s:HighlightStringSpellcheck()
+ syn region goString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@goStringGroup,@Spell
+ syn region goRawString start=+`+ end=+`+ contains=@Spell
+else
+ syn region goString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@goStringGroup
+ syn region goRawString start=+`+ end=+`+
+endif
+
+if s:HighlightFormatStrings()
+ " [n] notation is valid for specifying explicit argument indexes
+ " 1. Match a literal % not preceded by a %.
+ " 2. Match any number of -, #, 0, space, or +
+ " 3. Match * or [n]* or any number or nothing before a .
+ " 4. Match * or [n]* or any number or nothing after a .
+ " 5. Match [n] or nothing before a verb
+ " 6. Match a formatting verb
+ syn match goFormatSpecifier /\
+ \%([^%]\%(%%\)*\)\
+ \@<=%[-#0 +]*\
+ \%(\%(\%(\[\d\+\]\)\=\*\)\|\d\+\)\=\
+ \%(\.\%(\%(\%(\[\d\+\]\)\=\*\)\|\d\+\)\=\)\=\
+ \%(\[\d\+\]\)\=[vTtbcdoqxXUeEfFgGspw]/ contained containedin=goString,goRawString
+ hi def link goFormatSpecifier goSpecialString
+endif
hi def link goString String
hi def link goRawString String
@@ -131,71 +214,263 @@ syn region goCharacter start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=
hi def link goCharacter Character
" Regions
-syn region goBlock start="{" end="}" transparent fold
syn region goParen start='(' end=')' transparent
+if s:FoldEnable('block')
+ syn region goBlock start="{" end="}" transparent fold
+else
+ syn region goBlock start="{" end="}" transparent
+endif
+
+" import
+if s:FoldEnable('import')
+ syn region goImport start='import (' end=')' transparent fold contains=goImport,goString,goComment
+else
+ syn region goImport start='import (' end=')' transparent contains=goImport,goString,goComment
+endif
+
+" var, const
+if s:FoldEnable('varconst')
+ syn region goVar start='var (' end='^\s*)$' transparent fold
+ \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator
+ syn region goConst start='const (' end='^\s*)$' transparent fold
+ \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator
+else
+ syn region goVar start='var (' end='^\s*)$' transparent
+ \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator
+ syn region goConst start='const (' end='^\s*)$' transparent
+ \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator
+endif
+
+" Single-line var, const, and import.
+syn match goSingleDecl /\%(import\|var\|const\) [^(]\@=/ contains=goImport,goVar,goConst
" Integers
-syn match goDecimalInt "\<\d\+\([Ee]\d\+\)\?\>"
-syn match goHexadecimalInt "\<0x\x\+\>"
-syn match goOctalInt "\<0\o\+\>"
-syn match goOctalError "\<0\o*[89]\d*\>"
+syn match goDecimalInt "\<-\=\(0\|[1-9]_\?\(\d\|\d\+_\?\d\+\)*\)\%([Ee][-+]\=\d\+\)\=\>"
+syn match goDecimalError "\<-\=\(_\(\d\+_*\)\+\|\([1-9]\d*_*\)\+__\(\d\+_*\)\+\|\([1-9]\d*_*\)\+_\+\)\%([Ee][-+]\=\d\+\)\=\>"
+syn match goHexadecimalInt "\<-\=0[xX]_\?\(\x\+_\?\)\+\>"
+syn match goHexadecimalError "\<-\=0[xX]_\?\(\x\+_\?\)*\(\([^ \t0-9A-Fa-f_)]\|__\)\S*\|_\)\>"
+syn match goOctalInt "\<-\=0[oO]\?_\?\(\o\+_\?\)\+\>"
+syn match goOctalError "\<-\=0[0-7oO_]*\(\([^ \t0-7oOxX_/)\]\}\:]\|[oO]\{2,\}\|__\)\S*\|_\|[oOxX]\)\>"
+syn match goBinaryInt "\<-\=0[bB]_\?\([01]\+_\?\)\+\>"
+syn match goBinaryError "\<-\=0[bB]_\?[01_]*\([^ \t01_)]\S*\|__\S*\|_\)\>"
hi def link goDecimalInt Integer
+hi def link goDecimalError Error
hi def link goHexadecimalInt Integer
+hi def link goHexadecimalError Error
hi def link goOctalInt Integer
+hi def link goOctalError Error
+hi def link goBinaryInt Integer
+hi def link goBinaryError Error
hi def link Integer Number
" Floating point
-syn match goFloat "\<\d\+\.\d*\([Ee][-+]\d\+\)\?\>"
-syn match goFloat "\<\.\d\+\([Ee][-+]\d\+\)\?\>"
-syn match goFloat "\<\d\+[Ee][-+]\d\+\>"
+syn match goFloat "\<-\=\d\+\.\d*\%([Ee][-+]\=\d\+\)\=\>"
+syn match goFloat "\<-\=\.\d\+\%([Ee][-+]\=\d\+\)\=\>"
hi def link goFloat Float
" Imaginary literals
-syn match goImaginary "\<\d\+i\>"
-syn match goImaginary "\<\d\+\.\d*\([Ee][-+]\d\+\)\?i\>"
-syn match goImaginary "\<\.\d\+\([Ee][-+]\d\+\)\?i\>"
-syn match goImaginary "\<\d\+[Ee][-+]\d\+i\>"
+syn match goImaginary "\<-\=\d\+i\>"
+syn match goImaginary "\<-\=\d\+[Ee][-+]\=\d\+i\>"
+syn match goImaginaryFloat "\<-\=\d\+\.\d*\%([Ee][-+]\=\d\+\)\=i\>"
+syn match goImaginaryFloat "\<-\=\.\d\+\%([Ee][-+]\=\d\+\)\=i\>"
hi def link goImaginary Number
+hi def link goImaginaryFloat Float
" Spaces after "[]"
-if go_highlight_array_whitespace_error != 0
- syn match goSpaceError display "\(\[\]\)\@<=\s\+"
+if s:HighlightArrayWhitespaceError()
+ syn match goSpaceError display "\%(\[\]\)\@<=\s\+"
endif
" Spacing errors around the 'chan' keyword
-if go_highlight_chan_whitespace_error != 0
+if s:HighlightChanWhitespaceError()
" receive-only annotation on chan type
- syn match goSpaceError display "\(<-\)\@<=\s\+\(chan\>\)\@="
+ "
+ " \(\<chan\>\)\@<!<- (only pick arrow when it doesn't come after a chan)
+ " this prevents picking up 'chan<- chan<-' but not '<- chan'
+ syn match goSpaceError display "\%(\%(\<chan\>\)\@<!<-\)\@<=\s\+\%(\<chan\>\)\@="
+
" send-only annotation on chan type
- syn match goSpaceError display "\(\<chan\)\@<=\s\+\(<-\)\@="
+ "
+ " \(<-\)\@<!\<chan\> (only pick chan when it doesn't come after an arrow)
+ " this prevents picking up '<-chan <-chan' but not 'chan <-'
+ syn match goSpaceError display "\%(\%(<-\)\@<!\<chan\>\)\@<=\s\+\%(<-\)\@="
+
" value-ignoring receives in a few contexts
- syn match goSpaceError display "\(\(^\|[={(,;]\)\s*<-\)\@<=\s\+"
+ syn match goSpaceError display "\%(\%(^\|[={(,;]\)\s*<-\)\@<=\s\+"
endif
" Extra types commonly seen
-if go_highlight_extra_types != 0
- syn match goExtraType /\<bytes\.\(Buffer\)\>/
- syn match goExtraType /\<io\.\(Reader\|Writer\|ReadWriter\|ReadWriteCloser\)\>/
- syn match goExtraType /\<reflect\.\(Kind\|Type\|Value\)\>/
+if s:HighlightExtraTypes()
+ syn match goExtraType /\<bytes\.\%(Buffer\)\>/
+ syn match goExtraType /\<context\.\%(Context\)\>/
+ syn match goExtraType /\<io\.\%(Reader\|ReadSeeker\|ReadWriter\|ReadCloser\|ReadWriteCloser\|Writer\|WriteCloser\|Seeker\)\>/
+ syn match goExtraType /\<reflect\.\%(Kind\|Type\|Value\)\>/
syn match goExtraType /\<unsafe\.Pointer\>/
endif
" Space-tab error
-if go_highlight_space_tab_error != 0
+if s:HighlightSpaceTabError()
syn match goSpaceError display " \+\t"me=e-1
endif
" Trailing white space error
-if go_highlight_trailing_whitespace_error != 0
+if s:HighlightTrailingWhitespaceError()
syn match goSpaceError display excludenl "\s\+$"
endif
hi def link goExtraType Type
hi def link goSpaceError Error
+
+
+" included from: https://github.com/athom/more-colorful.vim/blob/master/after/syntax/go.vim
+"
+" Comments; their contents
+syn keyword goTodo contained NOTE
+hi def link goTodo Todo
+
+syn match goVarArgs /\.\.\./
+
+" Operators;
+if s:HighlightOperators()
+ " match single-char operators: - + % < > ! & | ^ * =
+ " and corresponding two-char operators: -= += %= <= >= != &= |= ^= *= ==
+ syn match goOperator /[-+%<>!&|^*=]=\?/
+ " match / and /=
+ syn match goOperator /\/\%(=\|\ze[^/*]\)/
+ " match two-char operators: << >> &^
+ " and corresponding three-char operators: <<= >>= &^=
+ syn match goOperator /\%(<<\|>>\|&^\)=\?/
+ " match remaining two-char operators: := && || <- ++ --
+ syn match goOperator /:=\|||\|<-\|++\|--/
+ " match ...
+
+ hi def link goPointerOperator goOperator
+ hi def link goVarArgs goOperator
+endif
+hi def link goOperator Operator
+
+" Functions;
+if s:HighlightFunctions() || s:HighlightFunctionParameters()
+ syn match goDeclaration /\<func\>/ nextgroup=goReceiver,goFunction,goSimpleParams skipwhite skipnl
+ syn match goReceiverVar /\w\+\ze\s\+\%(\w\|\*\)/ nextgroup=goPointerOperator,goReceiverType skipwhite skipnl contained
+ syn match goPointerOperator /\*/ nextgroup=goReceiverType contained skipwhite skipnl
+ syn match goFunction /\w\+/ nextgroup=goSimpleParams contained skipwhite skipnl
+ syn match goReceiverType /\w\+/ contained
+ if s:HighlightFunctionParameters()
+ syn match goSimpleParams /(\%(\w\|\_s\|[*\.\[\],\{\}<>-]\)*)/ contained contains=goParamName,goType nextgroup=goFunctionReturn skipwhite skipnl
+ syn match goFunctionReturn /(\%(\w\|\_s\|[*\.\[\],\{\}<>-]\)*)/ contained contains=goParamName,goType skipwhite skipnl
+ syn match goParamName /\w\+\%(\s*,\s*\w\+\)*\ze\s\+\%(\w\|\.\|\*\|\[\)/ contained nextgroup=goParamType skipwhite skipnl
+ syn match goParamType /\%([^,)]\|\_s\)\+,\?/ contained nextgroup=goParamName skipwhite skipnl
+ \ contains=goVarArgs,goType,goSignedInts,goUnsignedInts,goFloats,goComplexes,goDeclType,goBlock
+ hi def link goReceiverVar goParamName
+ hi def link goParamName Identifier
+ endif
+ syn match goReceiver /(\s*\w\+\%(\s\+\*\?\s*\w\+\)\?\s*)\ze\s*\w/ contained nextgroup=goFunction contains=goReceiverVar skipwhite skipnl
+else
+ syn keyword goDeclaration func
+endif
+hi def link goFunction Function
+
+" Function calls;
+if s:HighlightFunctionCalls()
+ syn match goFunctionCall /\w\+\ze(/ contains=goBuiltins,goDeclaration
+endif
+hi def link goFunctionCall Type
+
+" Fields;
+if s:HighlightFields()
+ " 1. Match a sequence of word characters coming after a '.'
+ " 2. Require the following but dont match it: ( \@= see :h E59)
+ " - The symbols: / - + * % OR
+ " - The symbols: [] {} <> ) OR
+ " - The symbols: \n \r space OR
+ " - The symbols: , : .
+ " 3. Have the start of highlight (hs) be the start of matched
+ " pattern (s) offsetted one to the right (+1) (see :h E401)
+ syn match goField /\.\w\+\
+ \%(\%([\/\-\+*%]\)\|\
+ \%([\[\]{}<\>\)]\)\|\
+ \%([\!=\^|&]\)\|\
+ \%([\n\r\ ]\)\|\
+ \%([,\:.]\)\)\@=/hs=s+1
+endif
+hi def link goField Identifier
+
+" Structs & Interfaces;
+if s:HighlightTypes()
+ syn match goTypeConstructor /\<\w\+{\@=/
+ syn match goTypeDecl /\<type\>/ nextgroup=goTypeName skipwhite skipnl
+ syn match goTypeName /\w\+/ contained nextgroup=goDeclType skipwhite skipnl
+ syn match goDeclType /\<\%(interface\|struct\)\>/ skipwhite skipnl
+ hi def link goReceiverType Type
+else
+ syn keyword goDeclType struct interface
+ syn keyword goDeclaration type
+endif
+hi def link goTypeConstructor Type
+hi def link goTypeName Type
+hi def link goTypeDecl Keyword
+hi def link goDeclType Keyword
+
+" Variable Assignments
+if s:HighlightVariableAssignments()
+ syn match goVarAssign /\v[_.[:alnum:]]+(,\s*[_.[:alnum:]]+)*\ze(\s*([-^+|^\/%&]|\*|\<\<|\>\>|\&\^)?\=[^=])/
+ hi def link goVarAssign Special
+endif
+
+" Variable Declarations
+if s:HighlightVariableDeclarations()
+ syn match goVarDefs /\v\w+(,\s*\w+)*\ze(\s*:\=)/
+ hi def link goVarDefs Special
+endif
+
+" Build Constraints
+if s:HighlightBuildConstraints()
+ syn match goBuildKeyword display contained "+build"
+ " Highlight the known values of GOOS, GOARCH, and other +build options.
+ syn keyword goBuildDirectives contained
+ \ android darwin dragonfly freebsd linux nacl netbsd openbsd plan9
+ \ solaris windows 386 amd64 amd64p32 arm armbe arm64 arm64be ppc64
+ \ ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc
+ \ s390 s390x sparc sparc64 cgo ignore race
+
+ " Other words in the build directive are build tags not listed above, so
+ " avoid highlighting them as comments by using a matchgroup just for the
+ " start of the comment.
+ " The rs=s+2 option lets the \s*+build portion be part of the inner region
+ " instead of the matchgroup so it will be highlighted as a goBuildKeyword.
+ syn region goBuildComment matchgroup=goBuildCommentStart
+ \ start="//\s*+build\s"rs=s+2 end="$"
+ \ contains=goBuildKeyword,goBuildDirectives
+ hi def link goBuildCommentStart Comment
+ hi def link goBuildDirectives Type
+ hi def link goBuildKeyword PreProc
+endif
+
+if s:HighlightBuildConstraints() || s:FoldEnable('package_comment')
+ " One or more line comments that are followed immediately by a "package"
+ " declaration are treated like package documentation, so these must be
+ " matched as comments to avoid looking like working build constraints.
+ " The he, me, and re options let the "package" itself be highlighted by
+ " the usual rules.
+ exe 'syn region goPackageComment start=/\v(\/\/.*\n)+\s*package/'
+ \ . ' end=/\v\n\s*package/he=e-7,me=e-7,re=e-7'
+ \ . ' contains=@goCommentGroup,@Spell'
+ \ . (s:FoldEnable('package_comment') ? ' fold' : '')
+ exe 'syn region goPackageComment start=/\v^\s*\/\*.*\n(.*\n)*\s*\*\/\npackage/'
+ \ . ' end=/\v\*\/\n\s*package/he=e-7,me=e-7,re=e-7'
+ \ . ' contains=@goCommentGroup,@Spell'
+ \ . (s:FoldEnable('package_comment') ? ' fold' : '')
+ hi def link goPackageComment Comment
+endif
+
+" :GoCoverage commands
+hi def link goCoverageNormalText Comment
+
" Search backwards for a global declaration to start processing the syntax.
"syn sync match goSync grouphere NONE /^\(const\|var\|type\|func\)\>/
@@ -203,6 +478,9 @@ hi def link goSpaceError Error
" following as a more expensive/less precise workaround.
syn sync minlines=500
-let b:current_syntax = 'go'
+let b:current_syntax = "go"
+
+let &cpo = s:keepcpo
+unlet s:keepcpo
" vim: sw=2 sts=2 et
diff --git a/runtime/syntax/pascal.vim b/runtime/syntax/pascal.vim
index 3ab5c2e661..206df213a6 100644
--- a/runtime/syntax/pascal.vim
+++ b/runtime/syntax/pascal.vim
@@ -3,7 +3,7 @@
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainers: Xavier Crégut <xavier.cregut@enseeiht.fr>
" Mario Eusebio <bio@dq.fct.unl.pt>
-" Last Change: 2021 Apr 23
+" Last Change: 2021 May 20
" Contributors: Tim Chase <tchase@csc.com>,
" Stas Grabois <stsi@vtrails.com>,
diff --git a/runtime/syntax/redif.vim b/runtime/syntax/redif.vim
index 198d5c7530..9fa9064a86 100644
--- a/runtime/syntax/redif.vim
+++ b/runtime/syntax/redif.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: ReDIF
" Maintainer: Axel Castellane <axel.castellane@polytechnique.edu>
-" Last Change: 2021 Jun 17
+" Last Change: 2013 April 17
" Original Author: Axel Castellane
" Source: http://openlib.org/acmes/root/docu/redif_1.html
" File Extension: rdf
@@ -932,7 +932,7 @@ highlight redifFieldDeprecated term=undercurl cterm=undercurl gui=undercurl guis
" Sync: The template-type (ReDIF-Paper, ReDIF-Archive, etc.) influences which
" fields can follow. Thus sync must search backwards for it.
"
-" I would like to simply ask VIM to search backward for the first occurrence of
+" I would like to simply ask VIM to search backward for the first occurence of
" /^Template-Type:/, but it does not seem to be possible, so I have to start
" from the beginning of the file... This might slow down a lot for files that
" contain a lot of Template-Type statements.
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index 7aae7965a9..f695a1a1bf 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -12,7 +12,7 @@
if exists("b:current_syntax")
finish
endif
-let s:keepcpo= &cpo
+let s:keepcpo = &cpo
set cpo&vim
" vimTodo: contains common special-notices for comments {{{2
diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh
index e9242c4dbe..f4b817dfff 100755
--- a/scripts/vim-patch.sh
+++ b/scripts/vim-patch.sh
@@ -190,7 +190,7 @@ preprocess_patch() {
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/\S*\<\%(testdir/\)\@<!\%('"${na_src}"'\)@norm! d/\v(^diff)|%$ ' +w +q "$file"
# Remove unwanted Vim doc files.
- local na_doc='channel\.txt\|netbeans\.txt\|os_\w\+\.txt\|term\.txt\|todo\.txt\|version\d\.txt\|sponsor\.txt\|intro\.txt\|tags'
+ local na_doc='channel\.txt\|netbeans\.txt\|os_\w\+\.txt\|term\.txt\|todo\.txt\|version\d\.txt\|vim9\.txt\|sponsor\.txt\|intro\.txt\|tags'
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/runtime/doc/\<\%('"${na_doc}"'\)\>@norm! d/\v(^diff)|%$ ' +w +q "$file"
# Remove "Last change ..." changes in doc files.
diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c
index 878ffdf06f..3808f601d9 100644
--- a/src/nvim/api/buffer.c
+++ b/src/nvim/api/buffer.c
@@ -1232,7 +1232,7 @@ static Array extmark_to_array(ExtmarkInfo extmark, bool id, bool add_dict)
return rv;
}
-/// Returns position for a given extmark id
+/// Gets the position (0-indexed) of an extmark.
///
/// @param buffer Buffer handle, or 0 for current buffer
/// @param ns_id Namespace id from |nvim_create_namespace()|
@@ -1240,7 +1240,8 @@ static Array extmark_to_array(ExtmarkInfo extmark, bool id, bool add_dict)
/// @param opts Optional parameters. Keys:
/// - details: Whether to include the details dict
/// @param[out] err Error details, if any
-/// @return (row, col) tuple or empty list () if extmark id was absent
+/// @return 0-indexed (row, col) tuple or empty list () if extmark id was
+/// absent
ArrayOf(Integer) nvim_buf_get_extmark_by_id(Buffer buffer, Integer ns_id,
Integer id, Dictionary opts,
Error *err)
@@ -1320,10 +1321,10 @@ ArrayOf(Integer) nvim_buf_get_extmark_by_id(Buffer buffer, Integer ns_id,
///
/// @param buffer Buffer handle, or 0 for current buffer
/// @param ns_id Namespace id from |nvim_create_namespace()|
-/// @param start Start of range, given as (row, col) or valid extmark id
-/// (whose position defines the bound)
-/// @param end End of range, given as (row, col) or valid extmark id
-/// (whose position defines the bound)
+/// @param start Start of range: a 0-indexed (row, col) or valid extmark id
+/// (whose position defines the bound). |api-indexing|
+/// @param end End of range (inclusive): a 0-indexed (row, col) or valid
+/// extmark id (whose position defines the bound). |api-indexing|
/// @param opts Optional parameters. Keys:
/// - limit: Maximum number of marks to return
/// - details Whether to include the details dict
@@ -1424,8 +1425,8 @@ Array nvim_buf_get_extmarks(Buffer buffer, Integer ns_id,
///
/// @param buffer Buffer handle, or 0 for current buffer
/// @param ns_id Namespace id from |nvim_create_namespace()|
-/// @param line Line where to place the mark, 0-based
-/// @param col Column where to place the mark, 0-based
+/// @param line Line where to place the mark, 0-based. |api-indexing|
+/// @param col Column where to place the mark, 0-based. |api-indexing|
/// @param opts Optional parameters.
/// - id : id of the extmark to edit.
/// - end_line : ending line of the mark, 0-based inclusive.
diff --git a/src/nvim/api/ui_events.in.h b/src/nvim/api/ui_events.in.h
index 35d39a34d7..03fe5c5058 100644
--- a/src/nvim/api/ui_events.in.h
+++ b/src/nvim/api/ui_events.in.h
@@ -119,7 +119,8 @@ void msg_set_pos(Integer grid, Integer row, Boolean scrolled, String sep_char)
FUNC_API_SINCE(6) FUNC_API_BRIDGE_IMPL FUNC_API_COMPOSITOR_IMPL;
void win_viewport(Integer grid, Window win, Integer topline,
- Integer botline, Integer curline, Integer curcol)
+ Integer botline, Integer curline, Integer curcol,
+ Integer line_count)
FUNC_API_SINCE(7) FUNC_API_REMOTE_ONLY;
void popupmenu_show(Array items, Integer selected,
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index 5f48a26a29..f65d5cc185 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -275,9 +275,9 @@ static void on_redraw_event(void **argv)
///
/// On execution error: does not fail, but updates v:errmsg.
///
-/// If you need to input sequences like <C-o> use |nvim_replace_termcodes| to
-/// replace the termcodes and then pass the resulting string to nvim_feedkeys.
-/// You'll also want to enable escape_csi.
+/// To input sequences like <C-o> use |nvim_replace_termcodes()| (typically
+/// with escape_csi=true) to replace |keycodes|, then pass the result to
+/// nvim_feedkeys().
///
/// Example:
/// <pre>
@@ -1551,7 +1551,7 @@ void nvim_set_current_tabpage(Tabpage tabpage, Error *err)
}
}
-/// Creates a new namespace, or gets an existing one.
+/// Creates a new *namespace*, or gets an existing one.
///
/// Namespaces are used for buffer highlights and virtual text, see
/// |nvim_buf_add_highlight()| and |nvim_buf_set_extmark()|.
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 8216987635..f39a6a281b 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -84,6 +84,7 @@
#define CTRL_X_SPELL 14
#define CTRL_X_LOCAL_MSG 15 ///< only used in "ctrl_x_msgs"
#define CTRL_X_EVAL 16 ///< for builtin function complete()
+#define CTRL_X_CMDLINE_CTRL_X 17 ///< CTRL-X typed in CTRL_X_CMDLINE
#define CTRL_X_MSG(i) ctrl_x_msgs[(i) & ~CTRL_X_WANT_IDENT]
#define CTRL_X_MODE_LINE_OR_EVAL(m) \
@@ -109,6 +110,7 @@ static char *ctrl_x_msgs[] =
N_(" Spelling suggestion (s^N^P)"),
N_(" Keyword Local completion (^N^P)"),
NULL, // CTRL_X_EVAL doesn't use msg.
+ N_(" Command-line completion (^V^N^P)"),
};
static char *ctrl_x_mode_names[] = {
@@ -128,7 +130,8 @@ static char *ctrl_x_mode_names[] = {
"omni",
"spell",
NULL, // CTRL_X_LOCAL_MSG only used in "ctrl_x_msgs"
- "eval"
+ "eval",
+ "cmdline",
};
static char e_hitend[] = N_("Hit end of paragraph");
@@ -762,7 +765,8 @@ static int insert_execute(VimState *state, int key)
s->c = do_digraph(s->c);
- if ((s->c == Ctrl_V || s->c == Ctrl_Q) && ctrl_x_mode == CTRL_X_CMDLINE) {
+ if ((s->c == Ctrl_V || s->c == Ctrl_Q)
+ && (ctrl_x_mode == CTRL_X_CMDLINE || ctrl_x_mode == CTRL_X_CMDLINE_CTRL_X)) {
insert_do_complete(s);
return 1;
}
@@ -2028,11 +2032,8 @@ static bool del_char_after_col(int limit_col)
*/
static void ins_ctrl_x(void)
{
- /* CTRL-X after CTRL-X CTRL-V doesn't do anything, so that CTRL-X
- * CTRL-V works like CTRL-N */
- if (ctrl_x_mode != CTRL_X_CMDLINE) {
- /* if the next ^X<> won't ADD nothing, then reset
- * compl_cont_status */
+ if (ctrl_x_mode != CTRL_X_CMDLINE && ctrl_x_mode != CTRL_X_CMDLINE_CTRL_X) {
+ // if the next ^X<> won't ADD nothing, then reset compl_cont_status
if (compl_cont_status & CONT_N_ADDS) {
compl_cont_status |= CONT_INTRPT;
} else {
@@ -2043,6 +2044,10 @@ static void ins_ctrl_x(void)
edit_submode = (char_u *)_(CTRL_X_MSG(ctrl_x_mode));
edit_submode_pre = NULL;
showmode();
+ } else {
+ // CTRL-X in CTRL-X CTRL-V mode behaves differently to make CTRL-X
+ // CTRL-V look like CTRL-N
+ ctrl_x_mode = CTRL_X_CMDLINE_CTRL_X;
}
}
@@ -2052,7 +2057,8 @@ bool ctrl_x_mode_not_default(void)
return ctrl_x_mode != CTRL_X_NORMAL;
}
-// Whether CTRL-X was typed without a following character.
+// Whether CTRL-X was typed without a following character,
+// not including when in CTRL-X CTRL-V mode.
bool ctrl_x_mode_not_defined_yet(void)
{
return ctrl_x_mode == CTRL_X_NOT_DEFINED_YET;
@@ -2104,12 +2110,14 @@ bool vim_is_ctrl_x_key(int c)
case 0: // Not in any CTRL-X mode
return c == Ctrl_N || c == Ctrl_P || c == Ctrl_X;
case CTRL_X_NOT_DEFINED_YET:
+ case CTRL_X_CMDLINE_CTRL_X:
return c == Ctrl_X || c == Ctrl_Y || c == Ctrl_E
|| c == Ctrl_L || c == Ctrl_F || c == Ctrl_RSB
|| c == Ctrl_I || c == Ctrl_D || c == Ctrl_P
|| c == Ctrl_N || c == Ctrl_T || c == Ctrl_V
|| c == Ctrl_Q || c == Ctrl_U || c == Ctrl_O
- || c == Ctrl_S || c == Ctrl_K || c == 's';
+ || c == Ctrl_S || c == Ctrl_K || c == 's'
+ || c == Ctrl_Z;
case CTRL_X_SCROLL:
return c == Ctrl_Y || c == Ctrl_E;
case CTRL_X_WHOLE_LINE:
@@ -2163,6 +2171,7 @@ static bool ins_compl_accept_char(int c)
return vim_isfilec(c) && !vim_ispathsep(c);
case CTRL_X_CMDLINE:
+ case CTRL_X_CMDLINE_CTRL_X:
case CTRL_X_OMNI:
// Command line and Omni completion can work with just about any
// printable character, but do stop at white space.
@@ -3567,6 +3576,26 @@ static bool ins_compl_prep(int c)
return retval;
}
+ if (ctrl_x_mode == CTRL_X_CMDLINE_CTRL_X && c != Ctrl_X) {
+ if (c == Ctrl_V || c == Ctrl_Q || c == Ctrl_Z || ins_compl_pum_key(c)
+ || !vim_is_ctrl_x_key(c)) {
+ // Not starting another completion mode.
+ ctrl_x_mode = CTRL_X_CMDLINE;
+
+ // CTRL-X CTRL-Z should stop completion without inserting anything
+ if (c == Ctrl_Z) {
+ retval = true;
+ }
+ } else {
+ ctrl_x_mode = CTRL_X_CMDLINE;
+
+ // Other CTRL-X keys first stop completion, then start another
+ // completion mode.
+ ins_compl_prep(' ');
+ ctrl_x_mode = CTRL_X_NOT_DEFINED_YET;
+ }
+ }
+
// Set "compl_get_longest" when finding the first matches.
if (ctrl_x_mode == CTRL_X_NOT_DEFINED_YET
|| (ctrl_x_mode == CTRL_X_NORMAL && !compl_started)) {
@@ -3633,6 +3662,12 @@ static bool ins_compl_prep(int c)
case Ctrl_Q:
ctrl_x_mode = CTRL_X_CMDLINE;
break;
+ case Ctrl_Z:
+ ctrl_x_mode = CTRL_X_NORMAL;
+ edit_submode = NULL;
+ showmode();
+ retval = true;
+ break;
case Ctrl_P:
case Ctrl_N:
/* ^X^P means LOCAL expansion if nothing interrupted (eg we
@@ -4292,10 +4327,11 @@ static int ins_compl_get_exp(pos_T *ini)
break;
case CTRL_X_CMDLINE:
+ case CTRL_X_CMDLINE_CTRL_X:
if (expand_cmdline(&compl_xp, compl_pattern,
(int)STRLEN(compl_pattern),
&num_matches, &matches) == EXPAND_OK) {
- ins_compl_add_matches(num_matches, matches, FALSE);
+ ins_compl_add_matches(num_matches, matches, false);
}
break;
@@ -5135,7 +5171,7 @@ static int ins_complete(int c, bool enable_pum)
compl_col += startcol;
compl_length = (int)curs_col - startcol;
compl_pattern = addstar(line + compl_col, compl_length, EXPAND_FILES);
- } else if (ctrl_x_mode == CTRL_X_CMDLINE) {
+ } else if (ctrl_x_mode == CTRL_X_CMDLINE || ctrl_x_mode == CTRL_X_CMDLINE_CTRL_X) {
compl_pattern = vim_strnsave(line, curs_col);
set_cmd_context(&compl_xp, compl_pattern,
(int)STRLEN(compl_pattern), curs_col, false);
diff --git a/src/nvim/po/tr.po b/src/nvim/po/tr.po
index 3db3cbfef0..e1fef00863 100644
--- a/src/nvim/po/tr.po
+++ b/src/nvim/po/tr.po
@@ -1,16 +1,16 @@
# Turkish translations for Vim
# Vim Türkçe çevirileri
-# Copyright (C) 2020 Emir SARI <bitigchi@me.com>
+# Copyright (C) 2021 Emir SARI <emir_sari@msn.com>
# This file is distributed under the same license as the Vim package.
-# Emir SARI <bitigchi@me.com>, 2019-2020
+# Emir SARI <emir_sari@msn.com>, 2019-2021
#
msgid ""
msgstr ""
"Project-Id-Version: Vim Turkish Localization Project\n"
-"Report-Msgid-Bugs-To: Emir SARI <bitigchi@me.com>\n"
-"POT-Creation-Date: 2020-11-29 00:20+0300\n"
-"PO-Revision-Date: 2020-11-29 20:00+0300\n"
-"Last-Translator: Emir SARI <bitigchi@me.com>\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2021-07-16 17:56+0300\n"
+"PO-Revision-Date: 2021-07-16 20:00+0300\n"
+"Last-Translator: Emir SARI <emir_sari@msn.com>\n"
"Language-Team: Turkish <https://github.com/bitigchi/vim>\n"
"Language: tr\n"
"MIME-Version: 1.0\n"
@@ -28,7 +28,7 @@ msgid "E165: Cannot go beyond last file"
msgstr "E165: Son dosyadan öteye gidilemez"
msgid "E610: No argument to delete"
-msgstr "E610: Silinecek bir değişken yok"
+msgstr "E610: Silinecek bir argüman yok"
msgid "E249: window layout changed unexpectedly"
msgstr "E249: Pencere yerleşimi beklenmedik bir biçimde değişti"
@@ -94,6 +94,9 @@ msgstr "%s çalıştırılıyor"
msgid "autocommand %s"
msgstr "%s otokomutu"
+msgid "E972: Blob value does not have the right number of bytes"
+msgstr "E972: İkili geniş nesne değeri doğru bayt sayısına sahip değil"
+
msgid "E831: bf_key_init() called with empty password"
msgstr "E831: bf_key_init() boş bir şifre ile çağrıldı"
@@ -131,6 +134,27 @@ msgstr "E931: Arabellek kaydedilemedi"
msgid "E937: Attempt to delete a buffer that is in use: %s"
msgstr "E937: Kullanımda olan bir arabellek silinmeye çalışılıyor: %s"
+msgid "E90: Cannot unload last buffer"
+msgstr "E90: Son arabellek bellekten kaldırılamıyor"
+
+msgid "E84: No modified buffer found"
+msgstr "E84: Değiştirilmiş bir arabellek bulunamadı"
+
+msgid "E85: There is no listed buffer"
+msgstr "E85: Listelenmiş bir arabellek yok"
+
+msgid "E87: Cannot go beyond last buffer"
+msgstr "E87: Son arabellekten öteye gidilemez"
+
+msgid "E88: Cannot go before first buffer"
+msgstr "E88: İlk arabellekten öncesine gidilemez"
+
+#, c-format
+msgid "E89: No write since last change for buffer %d (add ! to override)"
+msgstr ""
+"E89: %d numaralı arabellek son değişiklikten sonra yazılmadı (geçersiz "
+"kılmak için ! ekleyin)"
+
msgid "E515: No buffers were unloaded"
msgstr "E515: Hiçbir arabellek bellekten kaldırılmadı"
@@ -158,27 +182,6 @@ msgid_plural "%d buffers wiped out"
msgstr[0] "%d arabellek yok edildi"
msgstr[1] "%d arabellek yok edildi"
-msgid "E90: Cannot unload last buffer"
-msgstr "E90: Son arabellek bellekten kaldırılamıyor"
-
-msgid "E84: No modified buffer found"
-msgstr "E84: Değiştirilmiş bir arabellek bulunamadı"
-
-msgid "E85: There is no listed buffer"
-msgstr "E85: Listelenmiş bir arabellek yok"
-
-msgid "E87: Cannot go beyond last buffer"
-msgstr "E87: Son arabellekten öteye gidilemez"
-
-msgid "E88: Cannot go before first buffer"
-msgstr "E88: İlk arabellekten öncesine gidilemez"
-
-#, c-format
-msgid "E89: No write since last change for buffer %d (add ! to override)"
-msgstr ""
-"E89: %d numaralı arabellek son değişiklikten sonra yazılmadı (geçersiz "
-"kılmak için ! ekleyin)"
-
msgid "E948: Job still running (add ! to end the job)"
msgstr "E948: İş hâlâ sürüyor (bitirmek için ! ekleyin)"
@@ -424,13 +427,13 @@ msgid "E901: gethostbyname() in channel_open()"
msgstr "E901: channel_open() içinde gethostbyname()"
msgid "E903: received command with non-string argument"
-msgstr "E903: Dizi olmayan değişken içeren komut alındı"
+msgstr "E903: Dizi olmayan argüman içeren komut alındı"
msgid "E904: last argument for expr/call must be a number"
-msgstr "E904: İfadenin/çağrının son değişkeni bir sayı olmalıdır"
+msgstr "E904: İfadenin/çağrının son argüman bir sayı olmalıdır"
msgid "E904: third argument for call must be a list"
-msgstr "E904: Çağrının üçüncü değişkeni bir liste olmalıdır"
+msgstr "E904: Çağrının üçüncü argümanı bir liste olmalıdır"
#, c-format
msgid "E905: received unknown command: %s"
@@ -449,7 +452,7 @@ msgstr "E631: %s(): Yazma başarısız"
#, c-format
msgid "E917: Cannot use a callback with %s()"
-msgstr "E917: %s() ile geri çağırma kullanılamaz"
+msgstr "E917: %s() ile geri çağırma kullanılamıyor"
msgid "E912: cannot use ch_evalexpr()/ch_sendexpr() with a raw or nl channel"
msgstr "E912: ch_evalexpr()/ch_sendexpr() raw/nl kanalları ile kullanılamaz"
@@ -511,6 +514,11 @@ msgid "Warning: Using a weak encryption method; see :help 'cm'"
msgstr ""
"Uyarı: Zayıf bir şifreleme yöntemi kullanılıyor; bilgi için: :help 'cm'"
+msgid ""
+"Note: Encryption of swapfile not supported, disabling swap- and undofile"
+msgstr "Takas dosyası şifrelemesi desteklenmiyor, takas ve geri al dosyası "
+"devre dışı bırakılıyor"
+
msgid "Enter encryption key: "
msgstr "Şifreleme anahtarı girin: "
@@ -570,7 +578,7 @@ msgid "%3d expr %s"
msgstr "%3d ifade %s"
msgid "extend() argument"
-msgstr "extend() değişkeni"
+msgstr "extend() argümanı"
#, c-format
msgid "E737: Key already exists: %s"
@@ -728,9 +736,6 @@ msgstr "E708: [:] en son gelmelidir"
msgid "E709: [:] requires a List or Blob value"
msgstr "E709: [:] bir liste veya ikili geniş nesne değeri gerektirir"
-msgid "E972: Blob value does not have the right number of bytes"
-msgstr "E972: İkili geniş nesne değeri doğru bayt sayısına sahip değil"
-
msgid "E996: Cannot lock a range"
msgstr "E996: Erim kilitlenemiyor"
@@ -741,7 +746,7 @@ msgid "E260: Missing name after ->"
msgstr "E260: -> sonrası ad eksik"
msgid "E695: Cannot index a Funcref"
-msgstr "E695: Bir Funcref dizinlenemez"
+msgstr "E695: Bir Funcref dizinlenemiyor"
msgid "Not enough memory to set references, garbage collection aborted!"
msgstr "Referansları ayarlamak için yetersiz bellek, atık toplama durduruldu"
@@ -759,9 +764,6 @@ msgstr ""
"\n"
"\tEn son şuradan ayarlandı: "
-msgid "E808: Number or Float required"
-msgstr "E808: Sayı veya kayan noktalı değer gerekiyor"
-
#, c-format
msgid "E158: Invalid buffer name: %s"
msgstr "E158: Geçersiz arabellek adı: %s"
@@ -780,7 +782,7 @@ msgid "E922: expected a dict"
msgstr "E922: Bir sözlük bekleniyordu"
msgid "E923: Second argument of function() must be a list or a dict"
-msgstr "E923: function() ikinci değişkeni bir liste veya sözlük olmalıdır"
+msgstr "E923: function() ikinci argümanı bir liste veya sözlük olmalıdır"
msgid ""
"&OK\n"
@@ -882,7 +884,7 @@ msgid "E742: Cannot change value of %s"
msgstr "E742: %s değeri değiştirilemiyor"
msgid "E921: Invalid callback argument"
-msgstr "E921: Geçersiz geri çağırma değişkeni"
+msgstr "E921: Geçersiz geri çağırma argümanı"
#, c-format
msgid "<%s>%s%s %d, Hex %02x, Oct %03o, Digr %s"
@@ -927,6 +929,10 @@ msgstr "E135: *Süzgeç* otokomutları şu anki arabelleği değiştirmemelidir"
msgid "[No write since last change]\n"
msgstr "[Son değişiklikten sonra yazılmadı]\n"
+#, c-format
+msgid "E503: \"%s\" is not a file or writable device"
+msgstr "E503: \"%s\", bir dosya veya yazılabilir aygıt değil"
+
msgid "Save As"
msgstr "Farklı Kaydet"
@@ -985,7 +991,7 @@ msgid "E143: Autocommands unexpectedly deleted new buffer %s"
msgstr "E143: yeni %s arabelleğini otokomutlar beklenmedik bir biçimde sildi"
msgid "E144: non-numeric argument to :z"
-msgstr "E144: :z için sayısal olmayan değişken"
+msgstr "E144: :z için sayısal olmayan argüman"
msgid "E145: Shell commands and some functionality not allowed in rvim"
msgstr "E145: rvim içinde kabuk komutları ve bazı işlevselliğe izin verilmez"
@@ -1091,9 +1097,6 @@ msgstr "Kaynak alınan dosyanın sonu"
msgid "End of function"
msgstr "İşlevin sonu"
-msgid "E464: Ambiguous use of user-defined command"
-msgstr "E464: Kullanıcı tanımlı komutun belirsiz kullanımı"
-
msgid "E492: Not an editor command"
msgstr "E492: Bir düzenleyici komutu değil"
@@ -1178,7 +1181,7 @@ msgid "E187: Unknown"
msgstr "E187: Bilinmeyen"
msgid "E465: :winsize requires two number arguments"
-msgstr "E465: :winsize iki adet sayı değişken gerektirir"
+msgstr "E465: :winsize iki adet sayı argüman gerektirir"
#, c-format
msgid "Window position: X %d, Y %d"
@@ -1188,7 +1191,7 @@ msgid "E188: Obtaining window position not implemented for this platform"
msgstr "E188: Pencere konumunu alma özelliği bu platformda mevcut değil"
msgid "E466: :winpos requires two number arguments"
-msgstr "E466: :winpos iki adet sayı değişken gerektirir"
+msgstr "E466: :winpos iki adet sayı argüman gerektirir"
msgid "E930: Cannot use :redir inside execute()"
msgstr "E930: :redir, execute() içinde kullanılamaz"
@@ -1340,6 +1343,9 @@ msgstr "E788: Şu anda başka bir arabellek düzenlenemez"
msgid "E811: Not allowed to change buffer information now"
msgstr "E811: Şu anda arabellek bilgisi değiştirilemez"
+msgid "[Command Line]"
+msgstr "[Komut Satırı]"
+
msgid "E199: Active window or buffer deleted"
msgstr "E199: Etkin pencere veya arabellek silinmiş"
@@ -1530,7 +1536,7 @@ msgid "E655: Too many symbolic links (cycle?)"
msgstr "E655: Çok fazla sembolik bağlantı (çevrim?)"
msgid "writefile() first argument must be a List or a Blob"
-msgstr "writefile() ilk değişkeni bir liste veya ikili geniş nesne olmalıdır"
+msgstr "writefile() ilk argümanı bir liste veya ikili geniş nesne olmalıdır"
msgid "Select Directory dialog"
msgstr "Dizin Seç iletişim kutusu"
@@ -1581,6 +1587,9 @@ msgstr "E446: İmleç altında bir dosya adı yok"
msgid "E447: Can't find file \"%s\" in path"
msgstr "E447: \"%s\" dosyası yol içinde bulunamadı"
+msgid "E808: Number or Float required"
+msgstr "E808: Sayı veya kayan noktalı değer gerekiyor"
+
msgid "E490: No fold found"
msgstr "E490: Kıvırma bulunamadı"
@@ -1805,7 +1814,7 @@ msgstr "E671: Pencere başlığı \"%s\" bulunamıyor"
#, c-format
msgid "E243: Argument not supported: \"-%s\"; Use the OLE version."
-msgstr "E243: \"-%s\" değişkeni desteklenmiyor; OLE sürümünü kullanın."
+msgstr "E243: \"-%s\" argümanı desteklenmiyor; OLE sürümünü kullanın."
msgid "E988: GUI cannot be used. Cannot execute gvim.exe."
msgstr "E988: Grafik arabirim kullanılamaz. gvim.exe çalıştırılamadı."
@@ -2042,11 +2051,11 @@ msgstr "E411: Vurgulama grubu bulunamadı: %s"
#, c-format
msgid "E412: Not enough arguments: \":highlight link %s\""
-msgstr "E412: Yetersiz sayıda değişken: \":highlight link %s\""
+msgstr "E412: Yetersiz sayıda argüman: \":highlight link %s\""
#, c-format
msgid "E413: Too many arguments: \":highlight link %s\""
-msgstr "E413: Çok fazla değişken: \":highlight link %s\""
+msgstr "E413: Çok fazla argüman: \":highlight link %s\""
msgid "E414: group has settings, highlight link ignored"
msgstr "E414: Grup ayarları mevcut, vurgulama bağlantısı yok sayıldı"
@@ -2061,7 +2070,7 @@ msgstr "E416: Eksik eşittir imi: %s"
#, c-format
msgid "E417: missing argument: %s"
-msgstr "E417: Eksik değişkenler: %s"
+msgstr "E417: Argüman eksik: %s"
#, c-format
msgid "E418: Illegal value: %s"
@@ -2086,7 +2095,7 @@ msgstr "E422: Uçbirim kodu çok uzun: %s"
#, c-format
msgid "E423: Illegal argument: %s"
-msgstr "E423: İzin verilmeyen değişken: %s"
+msgstr "E423: İzin verilmeyen argüman: %s"
msgid "E424: Too many different highlighting attributes in use"
msgstr "E424: Çok fazla değişik vurgulama kuralları kullanılıyor"
@@ -2295,7 +2304,7 @@ msgid "unknown option"
msgstr "bilinmeyen seçenek"
msgid "window index is out of range"
-msgstr "pencere dizini erimin dışında"
+msgstr "pencere sırası erimin dışında"
msgid "couldn't open buffer"
msgstr "arabellek açılamadı"
@@ -2513,9 +2522,6 @@ msgstr " Dahili anahtar sözcük tamamlaması (^N^P)"
msgid "Hit end of paragraph"
msgstr "Paragrafın sonuna varıldı"
-msgid "E839: Completion function changed window"
-msgstr "E839: Tamamlama işlevi pencereyi değiştirdi"
-
msgid "E840: Completion function deleted text"
msgstr "E840: Tamamlama işlevi metni sildi"
@@ -2594,23 +2600,23 @@ msgstr "E938: JSON'da yinelenmiş anahtar: \"%s\""
#, c-format
msgid "E899: Argument of %s must be a List or Blob"
-msgstr "E899: %s değişkeni bir liste veya ikili geniş nesne olmalıdır"
+msgstr "E899: %s argümanı bir liste veya ikili geniş nesne olmalıdır"
msgid "E900: maxdepth must be non-negative number"
msgstr "E900: maxdepth negatif olmayan bir sayı olmalı"
msgid "flatten() argument"
-msgstr "flatten() değişkeni"
+msgstr "flatten() argümanı"
#, c-format
msgid "E696: Missing comma in List: %s"
msgstr "E696: Listede virgül eksik: %s"
msgid "sort() argument"
-msgstr "sort() değişkeni"
+msgstr "sort() argümanı"
msgid "uniq() argument"
-msgstr "uniq() değişkeni"
+msgstr "uniq() argümanı"
msgid "E702: Sort compare function failed"
msgstr "E702: Sıralayıp karşılaştırma işlevi başarısız oldu"
@@ -2619,25 +2625,28 @@ msgid "E882: Uniq compare function failed"
msgstr "E882: Benzersizlik karşılaştırma işlevi başarısız oldu"
msgid "map() argument"
-msgstr "map() değişkeni"
+msgstr "map() argümanı"
msgid "mapnew() argument"
-msgstr "mapnew() değişkeni"
+msgstr "mapnew() argümanı"
msgid "filter() argument"
-msgstr "filter() değişkeni"
+msgstr "filter() argümanı"
msgid "add() argument"
-msgstr "add() değişkeni"
+msgstr "add() argümanı"
+
+msgid "extendnew() argument"
+msgstr "extendnew() argümanı"
msgid "insert() argument"
-msgstr "insert() değişkeni"
+msgstr "insert() argümanı"
msgid "remove() argument"
-msgstr "remove() değişkeni"
+msgstr "remove() argümanı"
msgid "reverse() argument"
-msgstr "reverse() değişkeni"
+msgstr "reverse() argümanı"
#, c-format
msgid "Current %slanguage: \"%s\""
@@ -2648,22 +2657,22 @@ msgid "E197: Cannot set language to \"%s\""
msgstr "E197: \"%s\" diline ayarlanamıyor"
msgid "Unknown option argument"
-msgstr "Bilinmeyen seçenek değişkeni"
+msgstr "Bilinmeyen seçenek argümanı"
msgid "Too many edit arguments"
-msgstr "Çok fazla düzenleme değişkeni"
+msgstr "Çok fazla düzenleme argümanı"
msgid "Argument missing after"
-msgstr "Şundan sonra değişken eksik:"
+msgstr "Şundan sonra argüman eksik:"
msgid "Garbage after option argument"
-msgstr "Seçenek değişkeninden sonra anlamsız veri"
+msgstr "Seçenek argümanından sonra anlamsız veri"
msgid "Too many \"+command\", \"-c command\" or \"--cmd command\" arguments"
-msgstr "Çok fazla \"+komut\", \"-c komut\" veya \"--cmd komut\" değişkeni"
+msgstr "Çok fazla \"+komut\", \"-c komut\" veya \"--cmd komut\" argümanı"
msgid "Invalid argument for"
-msgstr "Şunun için geçersiz değişken:"
+msgstr "Şunun için geçersiz argüman:"
#, c-format
msgid "%d files to edit\n"
@@ -2735,7 +2744,7 @@ msgstr ""
"Kullanım:"
msgid " vim [arguments] "
-msgstr " vim [değişkenler] "
+msgstr " vim [argümanlar] "
msgid ""
"\n"
@@ -2967,21 +2976,21 @@ msgid ""
"Arguments recognised by gvim (Motif version):\n"
msgstr ""
"\n"
-"gvim tarafından tanınan değişkenler (Motif sürümü):\n"
+"gvim tarafından tanınan argümanlar (Motif sürümü):\n"
msgid ""
"\n"
"Arguments recognised by gvim (neXtaw version):\n"
msgstr ""
"\n"
-"gvim tarafından tanınan değişkenler (neXtaw sürümü):\n"
+"gvim tarafından tanınan argümanlar (neXtaw sürümü):\n"
msgid ""
"\n"
"Arguments recognised by gvim (Athena version):\n"
msgstr ""
"\n"
-"gvim tarafından tanınan değişkenler (Athena sürümü):\n"
+"gvim tarafından tanınan argümanlar (Athena sürümü):\n"
msgid "-display <display>\tRun Vim on <display>"
msgstr "-display <ekran>\tVim'i <ekran>'da çalıştır"
@@ -3032,7 +3041,7 @@ msgid ""
"Arguments recognised by gvim (GTK+ version):\n"
msgstr ""
"\n"
-"gvim tarafından tanınan değişkenler (GTK+ sürümü):\n"
+"gvim tarafından tanınan argümanlar (GTK+ sürümü):\n"
msgid "-display <display>\tRun Vim on <display> (also: --display)"
msgstr "-display <ekran>\tVim'i <ekran>'da çalıştır (veya: --display)"
@@ -3078,7 +3087,7 @@ msgid "E228: makemap: Illegal mode"
msgstr "E228: makemap: İzin verilmeyen kip"
msgid "E460: entries missing in mapset() dict argument"
-msgstr "E460: mapset() sözlük değişkeninde eksik girdiler"
+msgstr "E460: mapset() sözlük argümanında eksik girdiler"
#, c-format
msgid "E357: 'langmap': Matching character missing for %s"
@@ -3716,13 +3725,13 @@ msgstr ""
"İ&ptal"
msgid "E766: Insufficient arguments for printf()"
-msgstr "E766: printf() için yetersiz değişkenler"
+msgstr "E766: printf() için yetersiz argüman"
msgid "E807: Expected Float argument for printf()"
-msgstr "E807: printf() için kayan noktalı değer türünde değişken bekleniyordu"
+msgstr "E807: printf() için kayan noktalı değer türünde argüman bekleniyordu"
msgid "E767: Too many arguments to printf()"
-msgstr "E767: printf() için çok fazla değişken"
+msgstr "E767: printf() için çok fazla argüman"
msgid "Type number and <Enter> or click with the mouse (q or empty cancels): "
msgstr ""
@@ -4014,12 +4023,12 @@ msgstr "E531: Grafik arabirimi başlatmak için \":gui\" yazın"
msgid "E589: 'backupext' and 'patchmode' are equal"
msgstr "E589: 'backupext' ve 'patchmode' birbirine eşit"
-msgid "E834: Conflicts with value of 'listchars'"
-msgstr "E834: 'listchars' değeriyle çakışmalar var"
-
msgid "E835: Conflicts with value of 'fillchars'"
msgstr "E835: 'fillchars' değeriyle çakışmalar var"
+msgid "E834: Conflicts with value of 'listchars'"
+msgstr "E834: 'listchars' değeriyle çakışmalar var"
+
msgid "E617: Cannot be changed in the GTK+ 2 GUI"
msgstr "E617: GTK+ 2 grafik arabiriminde değiştirilemez"
@@ -4392,7 +4401,7 @@ msgid "Cannot open file \"%s\""
msgstr "\"%s\" dosyası açılamıyor"
msgid "cannot have both a list and a \"what\" argument"
-msgstr "ya birinci ya da son değişken belirtilmelidir"
+msgstr "ya birinci ya da son argüman belirtilmelidir"
msgid "E681: Buffer is not loaded"
msgstr "E681: Arabellek yüklenemedi"
@@ -4725,10 +4734,10 @@ msgid "modeline"
msgstr "kip satırı"
msgid "--cmd argument"
-msgstr "--cmd değişkeni"
+msgstr "--cmd argümanı"
msgid "-c argument"
-msgstr "-c değişkeni"
+msgstr "-c argümanı"
msgid "environment variable"
msgstr "ortam değişkeni"
@@ -4736,6 +4745,9 @@ msgstr "ortam değişkeni"
msgid "error handler"
msgstr "hata işleyicisi"
+msgid "changed window size"
+msgstr "değiştirilen pencere boyutu"
+
msgid "W15: Warning: Wrong line separator, ^M may be missing"
msgstr "W15: Uyarı: Yanlış satır ayırıcısı, ^M eksik olabilir"
@@ -5215,6 +5227,9 @@ msgstr "E765: 'spellfile' içinde %d adet girdi yok"
msgid "Word '%.*s' removed from %s"
msgstr "'%.*s' sözcüğü %s içinden çıkartıldı"
+msgid "Seek error in spellfile"
+msgstr "Yazım dosyasında arama hatası"
+
#, c-format
msgid "Word '%.*s' added to %s"
msgstr "'%.*s' sözcüğü %s dosyasına eklendi"
@@ -5242,7 +5257,7 @@ msgstr " < \"%.*s\""
#, c-format
msgid "E390: Illegal argument: %s"
-msgstr "E390: İzin verilmeyen değişken: %s"
+msgstr "E390: İzin verilmeyen argüman: %s"
msgid "No Syntax items defined for this buffer"
msgstr "Bu arabellek için sözdizim ögeleri tanımlanmamış"
@@ -5343,7 +5358,7 @@ msgid " line breaks"
msgstr " satır sonu"
msgid "E395: contains argument not accepted here"
-msgstr "E395: Burada kabul edilmeyen bir değişken içeriyor"
+msgstr "E395: Burada kabul edilmeyen bir argüman içeriyor"
msgid "E844: invalid cchar value"
msgstr "E844: Geçersiz cchar değeri"
@@ -5375,7 +5390,7 @@ msgstr "E398: '=' eksik: %s"
#, c-format
msgid "E399: Not enough arguments: syntax region %s"
-msgstr "E399: Yetersiz değişken: %s sözdizim bölgesi"
+msgstr "E399: Yetersiz sayıda argüman: %s sözdizim bölgesi"
msgid "E848: Too many syntax clusters"
msgstr "E848: Çok fazla sözdizim kümesi"
@@ -5396,7 +5411,7 @@ msgstr "E403: Sözdizim eşitlemesi: Satır devamları dizgisi iki kez tanımlan
#, c-format
msgid "E404: Illegal arguments: %s"
-msgstr "E404: İzin verilmeyen değişkenler: %s"
+msgstr "E404: İzin verilmeyen argümanlar: %s"
#, c-format
msgid "E405: Missing equal sign: %s"
@@ -5404,7 +5419,7 @@ msgstr "E405: Eşittir imi eksik: %s"
#, c-format
msgid "E406: Empty argument: %s"
-msgstr "E406: Boş değişken: %s"
+msgstr "E406: Boş argüman: %s"
#, c-format
msgid "E407: %s not allowed here"
@@ -5539,7 +5554,7 @@ msgid "E436: No \"%s\" entry in termcap"
msgstr "E436: termcap içinde \"%s\" girdisi yok"
msgid "E437: terminal capability \"cm\" required"
-msgstr "E437: \"cm\" uçbirim kabiliyeti gerekiyor"
+msgstr "E437: \"cm\" uçbirim yeteneği gerekiyor"
msgid ""
"\n"
@@ -5688,16 +5703,16 @@ msgstr "E914: Bir Kanal, Kayan Noktalı Değer yerine kullanılıyor"
msgid "E975: Using a Blob as a Float"
msgstr "E975: Bir İkili Geniş Nesne, Kayan Noktalı Değer yerine kullanılıyor"
-msgid "E729: using Funcref as a String"
+msgid "E729: Using a Funcref as a String"
msgstr "E729: Funcref bir Dizi yerine kullanılıyor"
-msgid "E730: using List as a String"
+msgid "E730: Using a List as a String"
msgstr "E730: Liste bir Dizi yerine kullanılıyor"
-msgid "E731: using Dictionary as a String"
+msgid "E731: Using a Dictionary as a String"
msgstr "E731: Sözlük bir Dizi yerine kullanılıyor"
-msgid "E976: using Blob as a String"
+msgid "E976: Using a Blob as a String"
msgstr "E976: İkili Geniş Nesne bir Dizi yerine kullanılıyor"
msgid "E977: Can only compare Blob with Blob"
@@ -5892,16 +5907,16 @@ msgid "E180: Invalid complete value: %s"
msgstr "E180: Geçersiz tam değer: %s"
msgid "E468: Completion argument only allowed for custom completion"
-msgstr "E468: Tamamlama değişkenine yalnızca özel tamamlamalarda izin verilir"
+msgstr "E468: Tamamlama argümanına yalnızca özel tamamlamalarda izin verilir"
msgid "E467: Custom completion requires a function argument"
-msgstr "E467: Özel tamamlama bir işlev değişkeni gerektirir"
+msgstr "E467: Özel tamamlama bir işlev argümanı gerektirir"
msgid "E175: No attribute specified"
msgstr "E175: Bir öznitelik belirtilmemiş"
msgid "E176: Invalid number of arguments"
-msgstr "E176: Geçersiz değişken sayısı"
+msgstr "E176: Geçersiz argüman sayısı"
msgid "E177: Count cannot be specified twice"
msgstr "E177: Sayım iki defa belirtilemez"
@@ -5910,10 +5925,10 @@ msgid "E178: Invalid default value for count"
msgstr "E178: Sayım için geçersiz öntanımlı değer"
msgid "E179: argument required for -complete"
-msgstr "E179: -complete için değişken gerekiyor"
+msgstr "E179: -complete için argüman gerekiyor"
msgid "E179: argument required for -addr"
-msgstr "E179: -addr için değişken gerekiyor"
+msgstr "E179: -addr için argüman gerekiyor"
#, c-format
msgid "E174: Command already exists: add ! to replace it: %s"
@@ -5948,14 +5963,21 @@ msgstr "E130: Bilinmeyen işlev: %s"
#, c-format
msgid "E125: Illegal argument: %s"
-msgstr "E125: İzin verilmeyen değişken: %s"
+msgstr "E125: İzin verilmeyen argüman: %s"
#, c-format
msgid "E853: Duplicate argument name: %s"
-msgstr "E853: Yinelenen değişken adı: %s"
+msgstr "E853: Yinelenen argüman adı: %s"
msgid "E989: Non-default argument follows default argument"
-msgstr "E989: Öntanımlı olmayan değişken öntanımlı değişkenden sonra"
+msgstr "E989: Öntanımlı olmayan argüman öntanımlı argümandan sonra"
+
+msgid "E126: Missing :endfunction"
+msgstr "E126: :endfunction eksik"
+
+#, c-format
+msgid "W22: Text found after :endfunction: %s"
+msgstr "W22: :endfunction sonrası metin bulundu: %s"
#, c-format
msgid "E451: Expected }: %s"
@@ -5963,11 +5985,11 @@ msgstr "E451: } bekleniyordu: %s"
#, c-format
msgid "E740: Too many arguments for function %s"
-msgstr "E740: %s işlevi için çok fazla değişken"
+msgstr "E740: %s işlevi için çok fazla argüman"
#, c-format
msgid "E116: Invalid arguments for function %s"
-msgstr "E116: %s işlevi için geçersiz değişkenler"
+msgstr "E116: %s işlevi için geçersiz argümanlar"
msgid "E132: Function call depth is higher than 'maxfuncdepth'"
msgstr "E132: İşlevin çağırdığı derinlik 'maxfuncdepth'ten daha yüksek"
@@ -5989,7 +6011,7 @@ msgid "%s returning %s"
msgstr "%s, %s döndürüyor"
msgid "E699: Too many arguments"
-msgstr "E699: Çok fazla değişken"
+msgstr "E699: Çok fazla argüman"
#, c-format
msgid "E276: Cannot use function as a method: %s"
@@ -6032,17 +6054,6 @@ msgstr "E862: g: burada kullanılamaz"
msgid "E932: Closure function should not be at top level: %s"
msgstr "E932: Kapatma işlevi en üst düzeyde olmamalıdır: %s"
-msgid "E126: Missing :endfunction"
-msgstr "E126: :endfunction eksik"
-
-#, c-format
-msgid "W1001: Text found after :enddef: %s"
-msgstr "W1001: :enddef sonrası metin bulundu: %s"
-
-#, c-format
-msgid "W22: Text found after :endfunction: %s"
-msgstr "W22: :endfunction sonrası metin bulundu: %s"
-
#, c-format
msgid "E707: Function name conflicts with variable: %s"
msgstr "E707: İşlev adı şu değişken ile çakışıyor: %s"
@@ -6605,6 +6616,55 @@ msgstr "gvimext.dll hatası"
msgid "Path length too long!"
msgstr "Yol çok uzun!"
+msgid "E10: \\ should be followed by /, ? or &"
+msgstr "E10: \\ sonrasında /, ? veya & gelmeli"
+
+msgid "E11: Invalid in command-line window; <CR> executes, CTRL-C quits"
+msgstr "E11: Komut satırı penceresinde geçersiz; <CR> çalıştırır, CTRL-C çıkar"
+
+msgid "E12: Command not allowed from exrc/vimrc in current dir or tag search"
+msgstr ""
+"E12: Geçerli dizin veya etiket aramasında exrc veya vimrc'den komutlara izin "
+"verilmiyor"
+
+msgid "E13: File exists (add ! to override)"
+msgstr "E13: Dosya mevcut (geçersiz kılmak için ! ekleyin)"
+
+#, c-format
+msgid "E15: Invalid expression: \"%s\""
+msgstr "E15: Geçersiz ifade: \"%s\""
+
+msgid "E16: Invalid range"
+msgstr "E16: Geçersiz erim"
+
+#, c-format
+msgid "E17: \"%s\" is a directory"
+msgstr "E17: \"%s\" bir dizin"
+
+msgid "E18: Unexpected characters in :let"
+msgstr "E18: :let içinde beklenmeyen karakter"
+
+msgid "E18: Unexpected characters in assignment"
+msgstr "E18: Atama içerisinde beklenmedik karakterler"
+
+msgid "E19: Mark has invalid line number"
+msgstr "E19: İm satır numarası geçersiz"
+
+msgid "E20: Mark not set"
+msgstr "E20: İm ayarlanmamış"
+
+msgid "E21: Cannot make changes, 'modifiable' is off"
+msgstr "E21: Değişiklik yapılamıyor, 'modifiable' kapalı"
+
+msgid "E22: Scripts nested too deep"
+msgstr "E22: Betikler çok iç içe geçmiş"
+
+msgid "E23: No alternate file"
+msgstr "E23: Başka bir dosya yok"
+
+msgid "E24: No such abbreviation"
+msgstr "E24: Böyle bir kısaltma yok"
+
#, c-format
msgid "E121: Undefined variable: %s"
msgstr "E121: Tanımlanmamış değişken: %s"
@@ -6613,6 +6673,9 @@ msgstr "E121: Tanımlanmamış değişken: %s"
msgid "E121: Undefined variable: %c:%s"
msgstr "E121: Tanımlanmamış değişken: %c:%s"
+msgid "E464: Ambiguous use of user-defined command"
+msgstr "E464: Kullanıcı tanımlı komutun belirsiz kullanımı"
+
msgid "E476: Invalid command"
msgstr "E476: Geçersiz komut"
@@ -6633,15 +6696,19 @@ msgid ""
"E856: \"assert_fails()\" second argument must be a string or a list with one "
"or two strings"
msgstr ""
-"E856: \"assert_fails()\" ikinci değişkeni bir dizi veya bir veya iki dizili "
+"E856: \"assert_fails()\" ikinci argüman bir dizi veya bir veya iki dizili "
"bir liste olmalıdır"
+#, c-format
+msgid "E908: using an invalid value as a String: %s"
+msgstr "E908: Geçersiz bir değer bir Dizi yerine kullanılıyor: %s"
+
msgid "E909: Cannot index a special variable"
msgstr "E909: Özel bir değişken dizinlenemiyor"
#, c-format
-msgid "E1100: Missing :var: %s"
-msgstr "E1100: :var eksik: %s"
+msgid "E1100: Command not supported in Vim9 script (missing :var?): %s"
+msgstr "E1100: Komut Vim9 betiğinde desteklenmiyor (:var? eksik): %s"
#, c-format
msgid "E1001: Variable not found: %s"
@@ -6655,18 +6722,18 @@ msgid "E1003: Missing return value"
msgstr "E1003: Dönüş değeri eksik"
#, c-format
-msgid "E1004: White space required before and after '%s'"
-msgstr "E1004: '%s' öncesinde ve sonrasında boşluk gerekiyor"
+msgid "E1004: White space required before and after '%s' at \"%s\""
+msgstr "E1004: Şu konumda '%s' öncesinde ve sonrasında boşluk gerekiyor: \"%s\""
msgid "E1005: Too many argument types"
-msgstr "E1005: Çok fazla değişken türü"
+msgstr "E1005: Çok fazla argüman türü"
#, c-format
msgid "E1006: %s is used as an argument"
-msgstr "E1006: %s bir değişken olarak kullanılıyor"
+msgstr "E1006: %s bir argüman olarak kullanılıyor"
msgid "E1007: Mandatory argument after optional argument"
-msgstr "E1007: İsteğe bağlı değişken sonrasında zorunlu değişken"
+msgstr "E1007: İsteğe bağlı argüman sonrasında zorunlu argüman"
msgid "E1008: Missing <type>"
msgstr "E1008: <tür> eksik"
@@ -6688,7 +6755,7 @@ msgstr "E1012: Tür uyumsuzluğu, %s bekleniyordu, ancak %s alındı"
#, c-format
msgid "E1013: Argument %d: type mismatch, expected %s but got %s"
-msgstr "E1013: %d değişkeni: Tür uyumsuzluğu, %s bekleniyordu, ancak %s alındı"
+msgstr "E1013: %d argümanı: Tür uyumsuzluğu, %s bekleniyordu, ancak %s alındı"
#, c-format
msgid "E1014: Invalid key: %s"
@@ -6728,8 +6795,8 @@ msgid "E1022: Type or initialization required"
msgstr "E1022: Tür veya ilklendirme gerekiyor"
#, c-format
-msgid "E1023: Using a Number as a Bool: %d"
-msgstr "E1023: Bir Sayı, bir Bool yerine kullanılıyor: %d"
+msgid "E1023: Using a Number as a Bool: %lld"
+msgstr "E1023: Bir Sayı, bir Boole yerine kullanılıyor: %lld"
msgid "E1024: Using a Number as a String"
msgstr "E1024: Bir Sayı, bir Dizi yerine kullanılıyor"
@@ -6768,11 +6835,11 @@ msgid "E1034: Cannot use reserved name %s"
msgstr "E1034: Ayrılmış ad %s kullanılamaz"
msgid "E1035: % requires number arguments"
-msgstr "E1035: %, sayı değişkenler gerektirir"
+msgstr "E1035: %, sayı argümanları gerektirir"
#, c-format
msgid "E1036: %c requires number or float arguments"
-msgstr "E1036: %c, sayı veya kayan noktalı değer değişkenler gerektirir"
+msgstr "E1036: %c, sayı veya kayan noktalı değer argümanları gerektirir"
#, c-format
msgid "E1037: Cannot use \"%s\" with %s"
@@ -6798,7 +6865,7 @@ msgid "E1043: Invalid command after :export"
msgstr "E1043: :export sonrası geçersiz komut"
msgid "E1044: Export with invalid argument"
-msgstr "E1044: Geçersiz değişkenle dışa aktarım"
+msgstr "E1044: Geçersiz argümanla dışa aktarım"
msgid "E1045: Missing \"as\" after *"
msgstr "E1045: * sonrası \"as\" eksik"
@@ -6817,11 +6884,12 @@ msgstr "E1048: Betikte öge bulunamadı: %s"
msgid "E1049: Item not exported in script: %s"
msgstr "E1049: Betikte öge dışa aktarılmadı: %s"
-msgid "E1050: Colon required before a range"
-msgstr "E1050: Bir erim öncesi iki nokta gerekiyor"
+#, c-format
+msgid "E1050: Colon required before a range: %s"
+msgstr "E1050: Bir erim öncesi iki nokta gerekiyor: %s"
msgid "E1051: Wrong argument type for +"
-msgstr "E1051: + için hatalı değişken türü"
+msgstr "E1051: + için hatalı argüman türü"
#, c-format
msgid "E1052: Cannot declare an option: %s"
@@ -6875,12 +6943,12 @@ msgid "E1067: Separator mismatch: %s"
msgstr "E1067: Ayırıcı uyumsuzluğu: %s"
#, c-format
-msgid "E1068: No white space allowed before '%s'"
-msgstr "E1068: '%s' önce boşluğa izin verilmiyor"
+msgid "E1068: No white space allowed before '%s': %s"
+msgstr "E1068: '%s' önce boşluğa izin verilmiyor: %s"
#, c-format
-msgid "E1069: White space required after '%s'"
-msgstr "E1069: '%s' sonrası boşluk gerekiyor"
+msgid "E1069: White space required after '%s': %s"
+msgstr "E1069: '%s' sonrası boşluk gerekiyor: %s"
msgid "E1070: Missing \"from\""
msgstr "E1070: \"from\" eksik"
@@ -6908,7 +6976,7 @@ msgstr "E1076: Bu Vim kayan noktalı değer desteği ile derlenmemiş"
#, c-format
msgid "E1077: Missing argument type for %s"
-msgstr "E1077: %s için değişken türü eksik"
+msgstr "E1077: %s için argüman türü eksik"
#, c-format
msgid "E1081: Cannot unlet %s"
@@ -6933,7 +7001,7 @@ msgid "E1086: Cannot use :function inside :def"
msgstr "E1086: :def içinde :function kullanılamaz"
msgid "E1087: Cannot use an index when declaring a variable"
-msgstr "E1087: Bir değişken tanımlarken indeks kullanılamaz"
+msgstr "E1087: Bir değişken tanımlarken dizinleme kullanılamaz"
#, c-format
msgid "E1089: Unknown variable: %s"
@@ -6941,7 +7009,7 @@ msgstr "E1089: Bilinmeyen değişken: %s"
#, c-format
msgid "E1090: Cannot assign to argument %s"
-msgstr "E1090: %s değişkenine atanamıyor"
+msgstr "E1090: %s argümanına atanamıyor"
#, c-format
msgid "E1091: Function is not compiled: %s"
@@ -6989,11 +7057,11 @@ msgid "E1105: Cannot convert %s to string"
msgstr "E1105: %s bir diziye dönüştürülemiyor"
msgid "E1106: One argument too many"
-msgstr "E1106: Bir değişken fazladan"
+msgstr "E1106: Bir argüman fazladan"
#, c-format
msgid "E1106: %d arguments too many"
-msgstr "E1106: %d değişken fazladan"
+msgstr "E1106: %d argüman fazladan"
msgid "E1107: String, List, Dict or Blob required"
msgstr "E1107: Dizi, Liste, Sözlük veya İkili Nesne gerekiyor"
@@ -7026,10 +7094,10 @@ msgid "E1114: Only values of 0x100 and higher supported"
msgstr "E1114: Yalnızca 0x100 ve daha yüksek değerler destekleniyor"
msgid "E1115: \"assert_fails()\" fourth argument must be a number"
-msgstr "E1115: \"assert_fails()\" dördüncü değişkeni bir sayı olmalıdır"
+msgstr "E1115: \"assert_fails()\" dördüncü argüman bir sayı olmalıdır"
msgid "E1116: \"assert_fails()\" fifth argument must be a string"
-msgstr "E1116: \"assert_fails()\" beşinci değişkeni bir dizi olmalıdır"
+msgstr "E1116: \"assert_fails()\" beşinci argüman bir dizi olmalıdır"
msgid "E1117: Cannot use ! with nested :def"
msgstr "E1117: !, iç içe geçmiş :def ile kullanılamaz"
@@ -7080,7 +7148,7 @@ msgid "E1131: Cannot add to null blob"
msgstr "E1131: Null ikili geniş nesnesine ekleme yapılamaz"
msgid "E1132: Missing function argument"
-msgstr "E1132: İşlev değişkeni eksik"
+msgstr "E1132: İşlev argümanı eksik"
msgid "E1133: Cannot extend a null dict"
msgstr "E1133: Bir null sözlük genişletilemez"
@@ -7108,12 +7176,259 @@ msgstr "E1138: Bir Boole, Sayı yerine kullanılıyor"
msgid "E1139: Missing matching bracket after dict key"
msgstr "E1139: Sözlük anahtarı sonrası eşleşen ayraç eksik"
-msgid "E1140: For argument must be a sequence of lists"
-msgstr "E1140: For değişkeni listelerin bir sıralaması olmalıdır"
+msgid "E1140: :for argument must be a sequence of lists"
+msgstr "E1140: :for argümanı listelerin bir sıralaması olmalıdır"
msgid "E1141: Indexable type required"
msgstr "E1141: İndekslenebilir tür gerekiyor"
+msgid "E1142: Non-empty string required"
+msgstr "E1142: Boş olmayan dizi gerekiyor"
+
+#, c-format
+msgid "E1143: Empty expression: \"%s\""
+msgstr "E1143: Boş ifade: \"%s\""
+
+#, c-format
+msgid "E1144: Command \"%s\" is not followed by white space: %s"
+msgstr "E1144: \"%s\" komutu sonrasında boşluk gelmiyor: %s"
+
+#, c-format
+msgid "E1145: Missing heredoc end marker: %s"
+msgstr "E1145: Son imleyicisi eksik: %s"
+
+#, c-format
+msgid "E1146: Command not recognized: %s"
+msgstr "E1146: Komut tanınamadı: %s"
+
+msgid "E1147: List not set"
+msgstr "E1147: Liste ayarlanmamış"
+
+#, c-format
+msgid "E1148: Cannot index a %s"
+msgstr "E1148: Bir %s dizinlenemiyor"
+
+#, c-format
+msgid "E1149: Script variable is invalid after reload in function %s"
+msgstr "E1149: %s işlevindeki yeniden yüklemeden sonra betik değişkeni geçersiz"
+
+msgid "E1150: Script variable type changed"
+msgstr "E1150: Betik değişkeni türü değiştirildi"
+
+msgid "E1151: Mismatched endfunction"
+msgstr "E1151: Eşleşmeyen endfunction"
+
+msgid "E1152: Mismatched enddef"
+msgstr "E1152: Eşleşmeyen enddef"
+
+msgid "E1153: Invalid operation for bool"
+msgstr "E1153: Boole için geçersiz işlem"
+
+msgid "E1154: Divide by zero"
+msgstr "E1154: Sıfır ile bölüm"
+
+msgid "E1155: Cannot define autocommands for ALL events"
+msgstr "E1155: Otokomutlar TÜM olaylar için tanımlanamıyor"
+
+msgid "E1156: Cannot change the argument list recursively"
+msgstr "E1156: Değişken listesi özyineli olarak değiştirilemiyor"
+
+msgid "E1157: Missing return type"
+msgstr "E1157: Dönüş türü eksik"
+
+msgid "E1158: Cannot use flatten() in Vim9 script"
+msgstr "E1158: flatten(), Vim9 betiğinde kullanılamaz"
+
+msgid "E1159: Cannot split a window when closing the buffer"
+msgstr "E1159: Arabellek kapatılırken bir pencere bölünemez"
+
+msgid "E1160: Cannot use a default for variable arguments"
+msgstr "E1160: Değişken argümanları için bir öntanımlı kullanılamaz"
+
+#, c-format
+msgid "E1161: Cannot json encode a %s"
+msgstr "E1161: Bir %s JSON olarak kodlanamıyor"
+
+#, c-format
+msgid "E1162: Register name must be one character: %s"
+msgstr "E1162: Yazmaç adı tek bir karakter olmalıdır: %s"
+
+#, c-format
+msgid "E1163: Variable %d: type mismatch, expected %s but got %s"
+msgstr "E1163: %d değişkeni: Tür uyumsuzluğu, %s bekleniyordu, ancak %s alındı"
+
+msgid "E1164: vim9cmd must be followed by a command"
+msgstr "E1164: vim9cmd sonrasında bir komut gelmelidir"
+
+#, c-format
+msgid "E1165: Cannot use a range with an assignment: %s"
+msgstr "E1165: Bir atama ile bir erim kullanılamıyor: %s"
+
+msgid "E1166: Cannot use a range with a dictionary"
+msgstr "E1166: Bir sözlük ile bir erim kullanılamıyor"
+
+#, c-format
+msgid "E1167: Argument name shadows existing variable: %s"
+msgstr "E1167: Argüman adı var olan değişkeni gölgeliyor: %s"
+
+#, c-format
+msgid "E1168: Argument already declared in the script: %s"
+msgstr "E1168: Betikte argüman halihazırda tanımlanmış: %s"
+
+msgid "E1169: 'import * as {name}' not supported here"
+msgstr "E1169: 'import * as {name} burada desteklenmiyor"
+
+msgid "E1170: Cannot use #{ to start a comment"
+msgstr "E1170: Bir yorum başlatmak için #{ kullanılamaz"
+
+msgid "E1171: Missing } after inline function"
+msgstr "E1171: Satıriçi işlevden sonra } eksik"
+
+msgid "E1172: Cannot use default values in a lambda"
+msgstr "E1172: Bir lambda içerisinde öntanımlı değerler kullanılamıyor"
+
+#, c-format
+msgid "E1173: Text found after enddef: %s"
+msgstr "E1173: :enddef sonrası metin bulundu: %s"
+
+#, c-format
+msgid "E1174: String required for argument %d"
+msgstr "E1174: %d argümanı için dizi gerekiyor"
+
+#, c-format
+msgid "E1175: Non-empty string required for argument %d"
+msgstr "E1175: %d argümanı için boş olmayan dizi gerekiyor"
+
+msgid "E1176: Misplaced command modifier"
+msgstr "E1176: Yanlış yere konulmuş komut değiştiricisi"
+
+#, c-format
+msgid "E1177: For loop on %s not supported"
+msgstr "E1177: %s üzerinde for döngüsü desteklenmiyor"
+
+msgid "E1178: Cannot lock or unlock a local variable"
+msgstr "E1178: Bir yerel değişken kilitlenemiyor/kilidi açılamıyor"
+
+#, c-format
+msgid ""
+"E1179: Failed to extract PWD from %s, check your shell's config related to "
+"OSC 7"
+msgstr ""
+"E1179: %s içinden PWD çıkarılamadı, kabuğunuzun OSC 7 ile ilgili "
+"yapılandırmasını denetleyin"
+
+#, c-format
+msgid "E1180: Variable arguments type must be a list: %s"
+msgstr "E1180: Değişken argümanları türü bir liste olmalıdır: %s"
+
+msgid "E1181: Cannot use an underscore here"
+msgstr "E1181: Alt çizgi burada kullanılamaz"
+
+msgid "E1182: Blob required"
+msgstr "E1182: İkili geniş nesne gerekiyor"
+
+#, c-format
+msgid "E1183: Cannot use a range with an assignment operator: %s"
+msgstr "E1183: Bir atama işleci ile bir erim kullanılamıyor: %s"
+
+msgid "E1184: Blob not set"
+msgstr "E1184: İkili geniş nesne ayarlanmamış"
+
+msgid "E1185: Cannot nest :redir"
+msgstr "E1185: :redir içe geçirilemiyor"
+
+msgid "E1185: Missing :redir END"
+msgstr "E1185: :redir END eksik"
+
+#, c-format
+msgid "E1186: Expression does not result in a value: %s"
+msgstr "E1186: İfade bir değer sonucu vermiyor: %s"
+
+msgid "E1187: Failed to source defaults.vim"
+msgstr "E1187: defaults.vim kaynaklanamadı"
+
+msgid "E1188: Cannot open a terminal from the command line window"
+msgstr "E1188: Komut satırı penceresinden bir uçbirim açılamıyor"
+
+#, c-format
+msgid "E1189: Cannot use :legacy with this command: %s"
+msgstr "E1189: :legacy, bu komut ile kullanılamıyor: %s"
+
+msgid "E1190: One argument too few"
+msgstr "E1190: Bir argüman daha gerekiyor"
+
+#, c-format
+msgid "E1190: %d arguments too few"
+msgstr "E1190: %d argüman daha gerekiyor"
+
+#, c-format
+msgid "E1191: Call to function that failed to compile: %s"
+msgstr "E1191: Derlenemeyen işlev çağrısı: %s"
+
+msgid "E1192: Empty function name"
+msgstr "E1192: Boş işlev adı"
+
+msgid "E1193: cryptmethod xchacha20 not built into this Vim"
+msgstr "E1193: cryptmethod xchacha20 bu Vim ile kullanılamıyor"
+
+msgid "E1194: Cannot encrypt header, not enough space"
+msgstr "E1194: Üstbilgi şifrelenemiyor, yetersiz alan"
+
+msgid "E1195: Cannot encrypt buffer, not enough space"
+msgstr "E1195: Arabellek şifrelenemiyor, yetersiz alan"
+
+msgid "E1196: Cannot decrypt header, not enough space"
+msgstr "E1196: Üstbilgi şifresi çözülemiyor, yetersiz alan"
+
+msgid "E1197: Cannot allocate_buffer for encryption"
+msgstr "E1197: Şifreleme için allocate_buffer yapılamıyor"
+
+msgid "E1198: Decryption failed: Header incomplete!"
+msgstr "E1198: Şifre çözümü başarısız: Üstbilgi tam değil!"
+
+msgid "E1199: Cannot decrypt buffer, not enough space"
+msgstr "E1199: Arabellek şifresi çözülemiyor, yetersiz alan"
+
+msgid "E1200: Decryption failed!"
+msgstr "E1200: Şifre çözümü başarısız!"
+
+msgid "E1201: Decryption failed: pre-mature end of file!"
+msgstr "E1201: Şifre çözümü başarısız: Beklenmedik dosya sonu!"
+
+#, c-format
+msgid "E1202: No white space allowed after '%s': %s"
+msgstr "E1202: '%s' sonrası boşluğa izin verilmiyor: %s"
+
+#, c-format
+msgid "E1203: Dot can only be used on a dictionary: %s"
+msgstr "E1203: Nokta yalnızca bir sözlükte kullanılabilir: %s"
+
+#, c-format
+msgid "E1204: No Number allowed after .: '\\%%%c'"
+msgstr "E1204: . sonrası Sayıya izin verilmiyor: '\\%%%c'"
+
+msgid "E1205: No white space allowed between option and"
+msgstr "E1205: and seçeneği arasında boşluğa izin verilmiyor"
+
+#, c-format
+msgid "E1206: Dictionary required for argument %d"
+msgstr "E1206: %d argümanı için sözlük gerekiyor"
+
+#, c-format
+msgid "E1207: Expression without an effect: %s"
+msgstr "E1207: Bir efekt olmadan ifade: %s"
+
+msgid "E1208: -complete used without -nargs"
+msgstr "E1208: -complete, -nargs olmadan kullanıldı"
+
+#, c-format
+msgid "E1209: Invalid value for a line number: \"%s\""
+msgstr "E1209: Satır numarası için geçersiz değer: \"%s\""
+
+#, c-format
+msgid "E1210: Number required for argument %d"
+msgstr "E1210: %d argümanı için sayı gerekiyor"
+
msgid "--No lines in buffer--"
msgstr "--Arabellek içinde satır yok--"
@@ -7123,17 +7438,6 @@ msgstr "E470: Komut durduruldu"
msgid "E471: Argument required"
msgstr "E471: Değişken gerekiyor"
-msgid "E10: \\ should be followed by /, ? or &"
-msgstr "E10: \\ sonrasında /, ? veya & gelmeli"
-
-msgid "E11: Invalid in command-line window; <CR> executes, CTRL-C quits"
-msgstr "E11: Komut satırı penceresinde geçersiz; <CR> çalıştırır, CTRL-C çıkar"
-
-msgid "E12: Command not allowed from exrc/vimrc in current dir or tag search"
-msgstr ""
-"E12: Geçerli dizin veya etiket aramasında exrc veya vimrc'den komutlara izin "
-"verilmiyor"
-
msgid "E171: Missing :endif"
msgstr "E171: :endif eksik"
@@ -7164,9 +7468,6 @@ msgstr "E588: :while olmadan :endwhile"
msgid "E588: :endfor without :for"
msgstr "E588: :for olmadan :endfor"
-msgid "E13: File exists (add ! to override)"
-msgstr "E13: Dosya mevcut (geçersiz kılmak için ! ekleyin)"
-
msgid "E472: Command failed"
msgstr "E472: Komut başarısız oldu"
@@ -7193,34 +7494,23 @@ msgid "Interrupted"
msgstr "Yarıda kesildi"
msgid "E474: Invalid argument"
-msgstr "E474: Geçersiz değişken"
+msgstr "E474: Geçersiz argüman"
#, c-format
msgid "E475: Invalid argument: %s"
-msgstr "E475: Geçersiz değişken: %s"
+msgstr "E475: Geçersiz argüman: %s"
#, c-format
msgid "E983: Duplicate argument: %s"
-msgstr "E983: Yinelenen değişken: %s"
+msgstr "E983: Yinelenen argüman: %s"
#, c-format
msgid "E475: Invalid value for argument %s"
-msgstr "E475: %s değişkeni için geçersiz değer"
+msgstr "E475: %s argümanı için geçersiz değer"
#, c-format
msgid "E475: Invalid value for argument %s: %s"
-msgstr "E475: %s değişkeni için geçersiz değer: %s"
-
-#, c-format
-msgid "E15: Invalid expression: %s"
-msgstr "E15: Geçersiz ifade: %s"
-
-msgid "E16: Invalid range"
-msgstr "E16: Geçersiz erim"
-
-#, c-format
-msgid "E17: \"%s\" is a directory"
-msgstr "E17: \"%s\" bir dizin"
+msgstr "E475: %s argümanı için geçersiz değer: %s"
msgid "E756: Spell checking is not possible"
msgstr "E756: Yazım denetimi olanaklı değil"
@@ -7236,24 +7526,6 @@ msgstr "E667: Fsync başarısız oldu"
msgid "E448: Could not load library function %s"
msgstr "E448: %s kitaplık işlevi yüklenemedi"
-msgid "E19: Mark has invalid line number"
-msgstr "E19: İm satır numarası geçersiz"
-
-msgid "E20: Mark not set"
-msgstr "E20: İm ayarlanmamış"
-
-msgid "E21: Cannot make changes, 'modifiable' is off"
-msgstr "E21: Değişiklik yapılamıyor, 'modifiable' kapalı"
-
-msgid "E22: Scripts nested too deep"
-msgstr "E22: Betikler çok iç içe geçmiş"
-
-msgid "E23: No alternate file"
-msgstr "E23: Başka bir dosya yok"
-
-msgid "E24: No such abbreviation"
-msgstr "E24: Böyle bir kısaltma yok"
-
msgid "E477: No ! allowed"
msgstr "E477: ! imine izin verilmiyor"
@@ -7327,7 +7599,7 @@ msgid "E485: Can't read file %s"
msgstr "E485: %s dosyası okunamıyor"
msgid "E38: Null argument"
-msgstr "E38: Anlamsız değişken"
+msgstr "E38: Anlamsız argüman"
msgid "E39: Number expected"
msgstr "E39: Sayı bekleniyordu"
@@ -7392,6 +7664,9 @@ msgstr "E794: Değişken kum havuzunda ayarlanamıyor: \"%s\""
msgid "E928: String required"
msgstr "E928: Dizi gerekiyor"
+msgid "E889: Number required"
+msgstr "E889: Sayı gerekiyor"
+
msgid "E713: Cannot use empty key for Dictionary"
msgstr "E713: Sözlük için boş anahtar kullanılamaz"
@@ -7411,11 +7686,11 @@ msgstr "E978: İkili geniş nesne için geçersiz işlem"
#, c-format
msgid "E118: Too many arguments for function: %s"
-msgstr "E118: İşlev için çok fazla değişken: %s"
+msgstr "E118: İşlev için çok fazla argüman: %s"
#, c-format
msgid "E119: Not enough arguments for function: %s"
-msgstr "E119: Şu işlev için yetersiz sayıda değişken: %s"
+msgstr "E119: Şu işlev için yetersiz sayıda argüman: %s"
#, c-format
msgid "E933: Function was deleted: %s"
@@ -7437,18 +7712,15 @@ msgstr "E697: Liste sonunda ']' eksik: %s"
#, c-format
msgid "E712: Argument of %s must be a List or Dictionary"
-msgstr "E712: %s ögesinin değişkeni bir liste veya sözlük olmalıdır"
+msgstr "E712: %s ögesinin argümanı bir liste veya sözlük olmalıdır"
#, c-format
msgid "E896: Argument of %s must be a List, Dictionary or Blob"
-msgstr "E896: %s değişkeni bir liste, sözlük veya ikili geniş nesne olmalıdır"
+msgstr "E896: %s argümanı bir liste, sözlük veya ikili geniş nesne olmalıdır"
msgid "E804: Cannot use '%' with Float"
msgstr "E804: Bir kayan noktalı değer ile '%' kullanılamaz"
-msgid "E908: using an invalid value as a String"
-msgstr "E908: Geçersiz bir değer bir Dizi yerine kullanılıyor"
-
msgid "E996: Cannot lock an option"
msgstr "E996: Seçenek kilitlenemiyor"
@@ -7456,9 +7728,6 @@ msgstr "E996: Seçenek kilitlenemiyor"
msgid "E113: Unknown option: %s"
msgstr "E113: Bilinmeyen seçenek: %s"
-msgid "E18: Unexpected characters in :let"
-msgstr "E18: :let içinde beklenmeyen karakter"
-
#, c-format
msgid "E998: Reduce of an empty %s with no initial value"
msgstr "E998: Başlangıç değeri olmayan boş bir %s için reduce() yapılamıyor"
@@ -7616,7 +7885,7 @@ msgstr "E957: Geçersiz pencere numarası"
#, c-format
msgid "E686: Argument of %s must be a List"
-msgstr "E686: %s değişkeni bir liste olmalı"
+msgstr "E686: %s argümanı bir liste olmalı"
msgid "E109: Missing ':' after '?'"
msgstr "E109: '?' sonrası ':' eksik"
@@ -7685,7 +7954,7 @@ msgstr "'%s' anahtarı sözlüğe eklenemedi"
#, c-format
msgid "index must be int or slice, not %s"
-msgstr "dizin bir tamsayı veya dilim olmalıdır, %s olamaz"
+msgstr "sıra bir tamsayı veya dilim olmalıdır, %s olamaz"
#, c-format
msgid "expected str() or unicode() instance, but got %s"
@@ -7762,10 +8031,10 @@ msgid "expected sequence element of size 2, but got sequence of size %d"
msgstr "2 boyut bir sıralama bekleniyordu, ancak %d boyut bir sıralama geldi"
msgid "list constructor does not accept keyword arguments"
-msgstr "liste yapıcısı anahtar sözcük değişkenleri kabul etmez"
+msgstr "liste yapıcısı anahtar sözcük argümanları kabul etmez"
msgid "list index out of range"
-msgstr "liste dizini erimin dışında"
+msgstr "liste sırası erimin dışında"
#, c-format
msgid "internal error: failed to get Vim list item %d"
@@ -8013,8 +8282,7 @@ msgstr ""
"düzenleyebilirsiniz."
msgid "\" Hit <Enter> on a help line to open a help window on this option."
-msgstr ""
-"\" Yardım penceresini açmak için seçenek adı üzerinde <Enter>'a basın."
+msgstr "\" Yardım penceresini açmak için seçenek adı üzerinde <Enter>'a basın."
msgid "\" Hit <Enter> on an index line to jump there."
msgstr ""
@@ -8056,7 +8324,8 @@ msgid "moving around, searching and patterns"
msgstr "dolaşma, arama ve dizgeler"
msgid "list of flags specifying which commands wrap to another line"
-msgstr "hangi komutların diğer satıra kaydırıldığını belirleyen bayraklar\n"
+msgstr ""
+"hangi komutların diğer satıra kaydırıldığını belirleyen bayraklar\n"
"listesi"
msgid ""
@@ -8081,6 +8350,9 @@ msgstr ":cd için kullanılan dizin adları listesi"
msgid "change to directory of file in buffer"
msgstr "arabellekteki dosyanın olduğu dizine değiştir"
+msgid "change to pwd of shell in terminal buffer"
+msgstr "uçbirim arabelleğindeki kabuğun pwd'sine geç"
+
msgid "search commands wrap around the end of the buffer"
msgstr "arama komutları, arabelleğin sonunda kaydırılır"
@@ -8320,7 +8592,8 @@ msgid "multiple windows"
msgstr "çoklu pencereler"
msgid "0, 1 or 2; when to use a status line for the last window"
-msgstr "0, 1 veya 2; son pencere için ne zaman bir durum satırı\n"
+msgstr ""
+"0, 1 veya 2; son pencere için ne zaman bir durum satırı\n"
"kullanılacağı"
msgid "alternate format to be used for a status line"
@@ -8382,7 +8655,8 @@ msgid "this window scrolls together with other bound windows"
msgstr "bu pencere, bağlı diğer pencerelerle birlikte kayar"
msgid "\"ver\", \"hor\" and/or \"jump\"; list of options for 'scrollbind'"
-msgstr "\"ver\", \"hor\" ve/veya \"jump\"; 'scrollbind' için seçenekler listesi"
+msgstr ""
+"\"ver\", \"hor\" ve/veya \"jump\"; 'scrollbind' için seçenekler listesi"
msgid "this window's cursor moves together with other bound windows"
msgstr "bu pencerenin imleci bağlı diğer pencerelerle birlikte kayar"
@@ -8394,7 +8668,8 @@ msgid "key that precedes Vim commands in a terminal window"
msgstr "bir uçbirim penceresinde Vim komutlarından önce gelen düğme"
msgid "max number of lines to keep for scrollback in a terminal window"
-msgstr "bir uçbirim penceresinde geri kaydırma için kullanılacak\n"
+msgstr ""
+"bir uçbirim penceresinde geri kaydırma için kullanılacak\n"
"en çok satır sayısı"
msgid "type of pty to use for a terminal window"
@@ -8522,8 +8797,7 @@ msgid "list of flags that specify how the GUI works"
msgstr "grafik arabirimin nice çalıştığını belirleyen bayraklar listesi"
msgid "\"icons\", \"text\" and/or \"tooltips\"; how to show the toolbar"
-msgstr ""
-"\"icons\", \"text\" ve/veya \"tooltips\"; araç çubuğu kipleri "
+msgstr "\"icons\", \"text\" ve/veya \"tooltips\"; araç çubuğu kipleri "
msgid "size of toolbar icons"
msgstr "araç çubuğu simgelerinin boyutu"
@@ -8679,7 +8953,8 @@ msgid "list of directories for undo files"
msgstr "geri al dosyaları için dizinler listesi"
msgid "maximum number lines to save for undo on a buffer reload"
-msgstr "arabellek yeniden yüklemesinde geri al için kaydedilecek\n"
+msgstr ""
+"arabellek yeniden yüklemesinde geri al için kaydedilecek\n"
"en çok satır sayısı"
msgid "changes have been made and not written to a file"
@@ -8704,7 +8979,8 @@ msgid "definition of what comment lines look like"
msgstr "yorum satırlarının nice görüneceğinin tanımı"
msgid "list of flags that tell how automatic formatting works"
-msgstr "kendiliğinden biçimlendirmenin nice çalıştığını anlatan\n"
+msgstr ""
+"kendiliğinden biçimlendirmenin nice çalıştığını anlatan\n"
"bayraklar listesi"
msgid "pattern to recognize a numbered list"
@@ -8714,7 +8990,8 @@ msgid "expression used for \"gq\" to format lines"
msgstr "satırları biçimlendirmek için \"gq\" için kullanılan ifade"
msgid "specifies how Insert mode completion works for CTRL-N and CTRL-P"
-msgstr "Ekleme kipi tamamlamasının CTRL-N ve CTRL-P için nice çalıştığını\n"
+msgstr ""
+"Ekleme kipi tamamlamasının CTRL-N ve CTRL-P için nice çalıştığını\n"
"belirler"
msgid "whether to use a popup menu for Insert mode completion"
@@ -8739,7 +9016,8 @@ msgid "list of dictionary files for keyword completion"
msgstr "anahtar sözcük tamamlaması için sözlük dosyaları listesi"
msgid "list of thesaurus files for keyword completion"
-msgstr "anahtar sözcük tamamlaması için eşanlamlılar sözlüğü dosyaları\n"
+msgstr ""
+"anahtar sözcük tamamlaması için eşanlamlılar sözlüğü dosyaları\n"
"listesi"
msgid "adjust case of a keyword completion match"
@@ -8883,7 +9161,8 @@ msgid "markers used when 'foldmethod' is \"marker\""
msgstr "'foldmethod' \"marker\" olduğunda kullanılan imleyiciler"
msgid "maximum fold depth for when 'foldmethod' is \"indent\" or \"syntax\""
-msgstr "'foldmethod' \"indent\" veya \"syntax\" olduğunda kullanılan en çok\n"
+msgstr ""
+"'foldmethod' \"indent\" veya \"syntax\" olduğunda kullanılan en çok\n"
"kıvırma derinliği"
msgid "diff mode"
@@ -9013,7 +9292,8 @@ msgid "use a swap file for this buffer"
msgstr "bu arabellek için bir takas dosyası kullan"
msgid "\"sync\", \"fsync\" or empty; how to flush a swap file to disk"
-msgstr "\"sync\", \"fsync\", veya boş; bir takas dosyasının diske\n"
+msgstr ""
+"\"sync\", \"fsync\", veya boş; bir takas dosyasının diske\n"
"nice floşlanacağı"
msgid "number of characters typed to cause a swap file update"
@@ -9089,13 +9369,14 @@ msgid "characters to escape when 'shellxquote' is ("
msgstr "'shellxquote' ( iken kaçırılacak karakterler"
msgid "argument for 'shell' to execute a command"
-msgstr "bir komut çalıştırmak için 'shell' için değişken"
+msgstr "bir komut çalıştırmak için 'shell' için argüman"
msgid "used to redirect command output to a file"
msgstr "komut çıktısını bir dosyaya yeniden yönlendirmek için kullanılır"
msgid "use a temp file for shell commands instead of using a pipe"
-msgstr "bir veri yolu kullanımı yerine kabuk komutları için geçici\n"
+msgstr ""
+"bir veri yolu kullanımı yerine kabuk komutları için geçici\n"
"bir dosya kullan"
msgid "program used for \"=\" command"
@@ -9108,7 +9389,8 @@ msgid "program used for the \"K\" command"
msgstr "\"K\" komutu için kullanılan program"
msgid "warn when using a shell command and a buffer has changes"
-msgstr "bir kabuk komutu kullanılıyorsa ve arabellekte değişiklikler\n"
+msgstr ""
+"bir kabuk komutu kullanılıyorsa ve arabellekte değişiklikler\n"
"varsa uyar"
msgid "running make and jumping to errors (quickfix)"
@@ -9124,7 +9406,8 @@ msgid "program used for the \":make\" command"
msgstr "\":make\" komutu için kullanılan program"
msgid "string used to put the output of \":make\" in the error file"
-msgstr "\":make\" komutunun çıktısını hata dosyasına koymak için\n"
+msgstr ""
+"\":make\" komutunun çıktısını hata dosyasına koymak için\n"
"kullanılan dizi"
msgid "name of the errorfile for the 'makeprg' command"
@@ -9179,7 +9462,8 @@ msgid "insert characters backwards"
msgstr "karakterleri geriye doğru ekle"
msgid "allow CTRL-_ in Insert and Command-line mode to toggle 'revins'"
-msgstr "'revins' açıp kapatmak için Ekleme ve Komut Satırı kipinde\n"
+msgstr ""
+"'revins' açıp kapatmak için Ekleme ve Komut Satırı kipinde\n"
"CTRL-_ izin ver"
msgid "the ASCII code for the first letter of the Hebrew alphabet"
@@ -9210,8 +9494,9 @@ msgid "apply 'langmap' to mapped characters"
msgstr "eşlemlenen karakterlere 'langmap' uygula"
msgid "when set never use IM; overrules following IM options"
-msgstr "ayarlandığında hiçbir zaman IM kullanma; aşağıdaki IM seçeneklerini "
-"geçersiz kılar"
+msgstr ""
+"ayarlandığında hiçbir zaman IM kullanma; aşağıdaki IM seçeneklerini geçersiz "
+"kılar"
msgid "in Insert mode: 1: use :lmap; 2: use IM; 0: neither"
msgstr "Ekleme kipinde: 1: :lmap kullan; 2; IM kullan; 0: hiçbiri"
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index e5d4752760..77d2b21a7a 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -9,13 +9,12 @@
#include <ctype.h>
#include <inttypes.h>
#include <stdbool.h>
-#include <string.h>
#include <stdlib.h>
+#include <string.h>
-#include "nvim/vim.h"
-#include "nvim/ascii.h"
#include "nvim/api/private/helpers.h"
-#include "nvim/syntax.h"
+#include "nvim/ascii.h"
+#include "nvim/buffer.h"
#include "nvim/charset.h"
#include "nvim/cursor_shape.h"
#include "nvim/eval.h"
@@ -23,30 +22,31 @@
#include "nvim/ex_docmd.h"
#include "nvim/fileio.h"
#include "nvim/fold.h"
+#include "nvim/garray.h"
#include "nvim/hashtab.h"
#include "nvim/highlight.h"
#include "nvim/indent_c.h"
+#include "nvim/keymap.h"
+#include "nvim/macros.h"
#include "nvim/mbyte.h"
#include "nvim/memline.h"
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/misc1.h"
-#include "nvim/keymap.h"
-#include "nvim/garray.h"
#include "nvim/option.h"
+#include "nvim/os/os.h"
+#include "nvim/os/time.h"
#include "nvim/os_unix.h"
#include "nvim/path.h"
-#include "nvim/macros.h"
#include "nvim/regexp.h"
#include "nvim/screen.h"
#include "nvim/sign.h"
#include "nvim/strings.h"
+#include "nvim/syntax.h"
#include "nvim/syntax_defs.h"
#include "nvim/terminal.h"
#include "nvim/ui.h"
-#include "nvim/os/os.h"
-#include "nvim/os/time.h"
-#include "nvim/buffer.h"
+#include "nvim/vim.h"
static bool did_syntax_onoff = false;
@@ -54,8 +54,8 @@ static bool did_syntax_onoff = false;
/// The ID of a highlight group is also called group ID. It is the index in
/// the highlight_ga array PLUS ONE.
typedef struct hl_group {
- char_u *sg_name; ///< highlight group name
- char *sg_name_u; ///< uppercase of sg_name
+ char_u *sg_name; ///< highlight group name
+ char *sg_name_u; ///< uppercase of sg_name
bool sg_cleared; ///< "hi clear" was used
int sg_attr; ///< Screen attr @see ATTR_ENTRY
int sg_link; ///< link to this highlight group ID
@@ -98,22 +98,22 @@ static inline struct hl_group * HL_TABLE(void)
return ((struct hl_group *)((highlight_ga.ga_data)));
}
-#define MAX_HL_ID 20000 /* maximum value for a highlight ID. */
+#define MAX_HL_ID 20000 // maximum value for a highlight ID.
-/* different types of offsets that are possible */
-#define SPO_MS_OFF 0 /* match start offset */
-#define SPO_ME_OFF 1 /* match end offset */
-#define SPO_HS_OFF 2 /* highl. start offset */
-#define SPO_HE_OFF 3 /* highl. end offset */
-#define SPO_RS_OFF 4 /* region start offset */
-#define SPO_RE_OFF 5 /* region end offset */
-#define SPO_LC_OFF 6 /* leading context offset */
+// different types of offsets that are possible
+#define SPO_MS_OFF 0 // match start offset
+#define SPO_ME_OFF 1 // match end offset
+#define SPO_HS_OFF 2 // highl. start offset
+#define SPO_HE_OFF 3 // highl. end offset
+#define SPO_RS_OFF 4 // region start offset
+#define SPO_RE_OFF 5 // region end offset
+#define SPO_LC_OFF 6 // leading context offset
#define SPO_COUNT 7
-/* Flags to indicate an additional string for highlight name completion. */
-static int include_none = 0; /* when 1 include "nvim/None" */
-static int include_default = 0; /* when 1 include "nvim/default" */
-static int include_link = 0; /* when 2 include "nvim/link" and "clear" */
+// Flags to indicate an additional string for highlight name completion.
+static int include_none = 0; // when 1 include "nvim/None"
+static int include_default = 0; // when 1 include "nvim/default"
+static int include_link = 0; // when 2 include "nvim/link" and "clear"
/// The "term", "cterm" and "gui" arguments can be any combination of the
/// following names, separated by commas (but no spaces!).
@@ -215,12 +215,12 @@ typedef struct {
proftime_T slowest;
proftime_T average;
int id;
- char_u *pattern;
+ char_u *pattern;
} time_entry_T;
struct name_list {
int flag;
- char *name;
+ char *name;
};
#ifdef INCLUDE_GENERATED_DECLARATIONS
@@ -228,40 +228,40 @@ struct name_list {
#endif
static char *(spo_name_tab[SPO_COUNT]) =
-{"ms=", "me=", "hs=", "he=", "rs=", "re=", "lc="};
+{ "ms=", "me=", "hs=", "he=", "rs=", "re=", "lc=" };
/* The sp_off_flags are computed like this:
* offset from the start of the matched text: (1 << SPO_XX_OFF)
- * offset from the end of the matched text: (1 << (SPO_XX_OFF + SPO_COUNT))
+ * offset from the end of the matched text: (1 << (SPO_XX_OFF + SPO_COUNT))
* When both are present, only one is used.
*/
-#define SPTYPE_MATCH 1 /* match keyword with this group ID */
-#define SPTYPE_START 2 /* match a regexp, start of item */
-#define SPTYPE_END 3 /* match a regexp, end of item */
-#define SPTYPE_SKIP 4 /* match a regexp, skip within item */
+#define SPTYPE_MATCH 1 // match keyword with this group ID
+#define SPTYPE_START 2 // match a regexp, start of item
+#define SPTYPE_END 3 // match a regexp, end of item
+#define SPTYPE_SKIP 4 // match a regexp, skip within item
#define SYN_ITEMS(buf) ((synpat_T *)((buf)->b_syn_patterns.ga_data))
-#define NONE_IDX -2 /* value of sp_sync_idx for "NONE" */
+#define NONE_IDX -2 // value of sp_sync_idx for "NONE"
/*
* Flags for b_syn_sync_flags:
*/
-#define SF_CCOMMENT 0x01 /* sync on a C-style comment */
-#define SF_MATCH 0x02 /* sync by matching a pattern */
+#define SF_CCOMMENT 0x01 // sync on a C-style comment
+#define SF_MATCH 0x02 // sync by matching a pattern
#define SYN_STATE_P(ssp) ((bufstate_T *)((ssp)->ga_data))
-#define MAXKEYWLEN 80 /* maximum length of a keyword */
+#define MAXKEYWLEN 80 // maximum length of a keyword
/*
* The attributes of the syntax item that has been recognized.
*/
-static int current_attr = 0; /* attr of current syntax word */
-static int current_id = 0; /* ID of current char for syn_get_id() */
-static int current_trans_id = 0; /* idem, transparency removed */
+static int current_attr = 0; // attr of current syntax word
+static int current_id = 0; // ID of current char for syn_get_id()
+static int current_trans_id = 0; // idem, transparency removed
static int current_flags = 0;
static int current_seqnr = 0;
static int current_sub_char = 0;
@@ -269,9 +269,9 @@ static int current_sub_char = 0;
/*
* Methods of combining two clusters
*/
-#define CLUSTER_REPLACE 1 /* replace first list with second */
-#define CLUSTER_ADD 2 /* add second list to first */
-#define CLUSTER_SUBTRACT 3 /* subtract second list from first */
+#define CLUSTER_REPLACE 1 // replace first list with second
+#define CLUSTER_ADD 2 // add second list to first
+#define CLUSTER_SUBTRACT 3 // subtract second list from first
#define SYN_CLSTR(buf) ((syn_cluster_T *)((buf)->b_syn_clusters.ga_data))
@@ -283,12 +283,12 @@ static int current_sub_char = 0;
* 22000 - 22999 CONTAINED indicator (current_syn_inc_tag added)
* 23000 - 32767 cluster IDs (subtract SYNID_CLUSTER for the cluster ID)
*/
-#define SYNID_ALLBUT MAX_HL_ID /* syntax group ID for contains=ALLBUT */
-#define SYNID_TOP 21000 /* syntax group ID for contains=TOP */
-#define SYNID_CONTAINED 22000 /* syntax group ID for contains=CONTAINED */
-#define SYNID_CLUSTER 23000 /* first syntax group ID for clusters */
+#define SYNID_ALLBUT MAX_HL_ID // syntax group ID for contains=ALLBUT
+#define SYNID_TOP 21000 // syntax group ID for contains=TOP
+#define SYNID_CONTAINED 22000 // syntax group ID for contains=CONTAINED
+#define SYNID_CLUSTER 23000 // first syntax group ID for clusters
-#define MAX_SYN_INC_TAG 999 /* maximum before the above overflow */
+#define MAX_SYN_INC_TAG 999 // maximum before the above overflow
#define MAX_CLUSTER_ID (32767 - SYNID_CLUSTER)
/*
@@ -334,7 +334,7 @@ static char msg_no_items[] = N_("No Syntax items defined for this buffer");
// valid of si_cont_list for containing all but contained groups
#define ID_LIST_ALL (int16_t *)-1
-static int next_seqnr = 1; /* value to use for si_seqnr */
+static int next_seqnr = 1; // value to use for si_seqnr
/*
* The next possible match in the current line for any pattern is remembered,
@@ -343,15 +343,15 @@ static int next_seqnr = 1; /* value to use for si_seqnr */
* If next_match_col == MAXCOL, no match found in this line.
* (All end positions have the column of the char after the end)
*/
-static int next_match_col; /* column for start of next match */
-static lpos_T next_match_m_endpos; /* position for end of next match */
-static lpos_T next_match_h_startpos; /* pos. for highl. start of next match */
-static lpos_T next_match_h_endpos; /* pos. for highl. end of next match */
-static int next_match_idx; /* index of matched item */
-static long next_match_flags; /* flags for next match */
-static lpos_T next_match_eos_pos; /* end of start pattn (start region) */
-static lpos_T next_match_eoe_pos; /* pos. for end of end pattern */
-static int next_match_end_idx; /* ID of group for end pattn or zero */
+static int next_match_col; // column for start of next match
+static lpos_T next_match_m_endpos; // position for end of next match
+static lpos_T next_match_h_startpos; // pos. for highl. start of next match
+static lpos_T next_match_h_endpos; // pos. for highl. end of next match
+static int next_match_idx; // index of matched item
+static long next_match_flags; // flags for next match
+static lpos_T next_match_eos_pos; // end of start pattn (start region)
+static lpos_T next_match_eoe_pos; // pos. for end of end pattern
+static int next_match_end_idx; // ID of group for end pattn or zero
static reg_extmatch_T *next_match_extmatch = NULL;
/*
@@ -365,8 +365,8 @@ static reg_extmatch_T *next_match_extmatch = NULL;
* The current state (within the line) of the recognition engine.
* When current_state.ga_itemsize is 0 the current state is invalid.
*/
-static win_T *syn_win; // current window for highlighting
-static buf_T *syn_buf; // current buffer for highlighting
+static win_T *syn_win; // current window for highlighting
+static buf_T *syn_buf; // current buffer for highlighting
static synblock_T *syn_block; // current buffer for highlighting
static proftime_T *syn_tm; // timeout limit
static linenr_T current_lnum = 0; // lnum of current state
@@ -396,19 +396,19 @@ void syn_set_timeout(proftime_T *tm)
* Start the syntax recognition for a line. This function is normally called
* from the screen updating, once for each displayed line.
* The buffer is remembered in syn_buf, because get_syntax_attr() doesn't get
- * it. Careful: curbuf and curwin are likely to point to another buffer and
+ * it. Careful: curbuf and curwin are likely to point to another buffer and
* window.
*/
void syntax_start(win_T *wp, linenr_T lnum)
{
- synstate_T *p;
- synstate_T *last_valid = NULL;
- synstate_T *last_min_valid = NULL;
- synstate_T *sp, *prev = NULL;
+ synstate_T *p;
+ synstate_T *last_valid = NULL;
+ synstate_T *last_min_valid = NULL;
+ synstate_T *sp, *prev = NULL;
linenr_T parsed_lnum;
linenr_T first_stored;
int dist;
- static int changedtick = 0; /* remember the last change ID */
+ static int changedtick = 0; // remember the last change ID
current_sub_char = NUL;
@@ -431,8 +431,9 @@ void syntax_start(win_T *wp, linenr_T lnum)
* Allocate syntax stack when needed.
*/
syn_stack_alloc();
- if (syn_block->b_sst_array == NULL)
- return; /* out of memory */
+ if (syn_block->b_sst_array == NULL) {
+ return; // out of memory
+ }
syn_block->b_sst_lasttick = display_tick;
/*
@@ -452,29 +453,33 @@ void syntax_start(win_T *wp, linenr_T lnum)
* state (this happens very often!). Otherwise invalidate
* current_state and figure it out below.
*/
- if (current_lnum != lnum)
+ if (current_lnum != lnum) {
invalidate_current_state();
- } else
+ }
+ } else {
invalidate_current_state();
+ }
/*
* Try to synchronize from a saved state in b_sst_array[].
* Only do this if lnum is not before and not to far beyond a saved state.
*/
if (INVALID_STATE(&current_state) && syn_block->b_sst_array != NULL) {
- /* Find last valid saved state before start_lnum. */
+ // Find last valid saved state before start_lnum.
for (p = syn_block->b_sst_first; p != NULL; p = p->sst_next) {
if (p->sst_lnum > lnum) {
break;
}
if (p->sst_change_lnum == 0) {
last_valid = p;
- if (p->sst_lnum >= lnum - syn_block->b_syn_sync_minlines)
+ if (p->sst_lnum >= lnum - syn_block->b_syn_sync_minlines) {
last_min_valid = p;
+ }
}
}
- if (last_min_valid != NULL)
+ if (last_min_valid != NULL) {
load_current_state(last_min_valid);
+ }
}
/*
@@ -483,24 +488,27 @@ void syntax_start(win_T *wp, linenr_T lnum)
*/
if (INVALID_STATE(&current_state)) {
syn_sync(wp, lnum, last_valid);
- if (current_lnum == 1)
- /* First line is always valid, no matter "minlines". */
+ if (current_lnum == 1) {
+ // First line is always valid, no matter "minlines".
first_stored = 1;
- else
+ } else {
/* Need to parse "minlines" lines before state can be considered
* valid to store. */
first_stored = current_lnum + syn_block->b_syn_sync_minlines;
- } else
+ }
+ } else {
first_stored = current_lnum;
+ }
/*
* Advance from the sync point or saved state until the current line.
* Save some entries for syncing with later on.
*/
- if (syn_block->b_sst_len <= Rows)
+ if (syn_block->b_sst_len <= Rows) {
dist = 999999;
- else
+ } else {
dist = syn_buf->b_ml.ml_line_count / (syn_block->b_sst_len - Rows) + 1;
+ }
while (current_lnum < lnum) {
syn_start_line();
(void)syn_finish_line(false);
@@ -512,26 +520,30 @@ void syntax_start(win_T *wp, linenr_T lnum)
/* Check if the saved state entry is for the current line and is
* equal to the current state. If so, then validate all saved
* states that depended on a change before the parsed line. */
- if (prev == NULL)
+ if (prev == NULL) {
prev = syn_stack_find_entry(current_lnum - 1);
- if (prev == NULL)
+ }
+ if (prev == NULL) {
sp = syn_block->b_sst_first;
- else
+ } else {
sp = prev;
- while (sp != NULL && sp->sst_lnum < current_lnum)
+ }
+ while (sp != NULL && sp->sst_lnum < current_lnum) {
sp = sp->sst_next;
+ }
if (sp != NULL
&& sp->sst_lnum == current_lnum
&& syn_stack_equal(sp)) {
parsed_lnum = current_lnum;
prev = sp;
while (sp != NULL && sp->sst_change_lnum <= parsed_lnum) {
- if (sp->sst_lnum <= lnum)
- /* valid state before desired line, use this one */
+ if (sp->sst_lnum <= lnum) {
+ // valid state before desired line, use this one
prev = sp;
- else if (sp->sst_change_lnum == 0)
- /* past saved states depending on change, break here. */
+ } else if (sp->sst_change_lnum == 0) {
+ // past saved states depending on change, break here.
break;
+ }
sp->sst_change_lnum = 0;
sp = sp->sst_next;
}
@@ -542,8 +554,9 @@ void syntax_start(win_T *wp, linenr_T lnum)
* saved state. But only when parsed at least 'minlines'. */
else if (prev == NULL
|| current_lnum == lnum
- || current_lnum >= prev->sst_lnum + dist)
+ || current_lnum >= prev->sst_lnum + dist) {
prev = store_current_state();
+ }
}
/* This can take a long time: break when CTRL-C pressed. The current
@@ -594,8 +607,8 @@ static void clear_current_state(void)
*/
static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid)
{
- buf_T *curbuf_save;
- win_T *curwin_save;
+ buf_T *curbuf_save;
+ win_T *curwin_save;
pos_T cursor_save;
int idx;
linenr_T lnum;
@@ -603,8 +616,8 @@ static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid)
linenr_T break_lnum;
bool had_sync_point;
stateitem_T *cur_si;
- synpat_T *spp;
- char_u *line;
+ synpat_T *spp;
+ char_u *line;
int found_flags = 0;
int found_match_idx = 0;
linenr_T found_current_lnum = 0;
@@ -625,22 +638,25 @@ static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid)
* where N is minlines * 1.5, or minlines * 2 if minlines is small.
* Watch out for overflow when minlines is MAXLNUM.
*/
- if (syn_block->b_syn_sync_minlines > start_lnum)
+ if (syn_block->b_syn_sync_minlines > start_lnum) {
start_lnum = 1;
- else {
- if (syn_block->b_syn_sync_minlines == 1)
+ } else {
+ if (syn_block->b_syn_sync_minlines == 1) {
lnum = 1;
- else if (syn_block->b_syn_sync_minlines < 10)
+ } else if (syn_block->b_syn_sync_minlines < 10) {
lnum = syn_block->b_syn_sync_minlines * 2;
- else
+ } else {
lnum = syn_block->b_syn_sync_minlines * 3 / 2;
+ }
if (syn_block->b_syn_sync_maxlines != 0
- && lnum > syn_block->b_syn_sync_maxlines)
+ && lnum > syn_block->b_syn_sync_maxlines) {
lnum = syn_block->b_syn_sync_maxlines;
- if (lnum >= start_lnum)
+ }
+ if (lnum >= start_lnum) {
start_lnum = 1;
- else
+ } else {
start_lnum -= lnum;
+ }
}
current_lnum = start_lnum;
@@ -660,12 +676,13 @@ static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid)
*/
for (; start_lnum > 1; --start_lnum) {
line = ml_get(start_lnum - 1);
- if (*line == NUL || *(line + STRLEN(line) - 1) != '\\')
+ if (*line == NUL || *(line + STRLEN(line) - 1) != '\\') {
break;
+ }
}
current_lnum = start_lnum;
- /* set cursor to start of search */
+ // set cursor to start of search
cursor_save = wp->w_cursor;
wp->w_cursor.lnum = start_lnum;
wp->w_cursor.col = 0;
@@ -676,7 +693,7 @@ static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid)
* Restrict the search for the end of a comment to b_syn_sync_maxlines.
*/
if (find_start_comment((int)syn_block->b_syn_sync_maxlines) != NULL) {
- for (idx = syn_block->b_syn_patterns.ga_len; --idx >= 0; )
+ for (idx = syn_block->b_syn_patterns.ga_len; --idx >= 0; ) {
if (SYN_ITEMS(syn_block)[idx].sp_syn.id
== syn_block->b_syn_sync_id
&& SYN_ITEMS(syn_block)[idx].sp_type == SPTYPE_START) {
@@ -685,9 +702,10 @@ static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid)
update_si_attr(current_state.ga_len - 1);
break;
}
+ }
}
- /* restore cursor and buffer */
+ // restore cursor and buffer
wp->w_cursor = cursor_save;
curwin = curwin_save;
curbuf = curbuf_save;
@@ -697,17 +715,18 @@ static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid)
*/
else if (syn_block->b_syn_sync_flags & SF_MATCH) {
if (syn_block->b_syn_sync_maxlines != 0
- && start_lnum > syn_block->b_syn_sync_maxlines)
+ && start_lnum > syn_block->b_syn_sync_maxlines) {
break_lnum = start_lnum - syn_block->b_syn_sync_maxlines;
- else
+ } else {
break_lnum = 0;
+ }
found_m_endpos.lnum = 0;
found_m_endpos.col = 0;
end_lnum = start_lnum;
lnum = start_lnum;
while (--lnum > break_lnum) {
- /* This can take a long time: break when CTRL-C pressed. */
+ // This can take a long time: break when CTRL-C pressed.
line_breakcheck();
if (got_int) {
invalidate_current_state();
@@ -715,7 +734,7 @@ static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid)
break;
}
- /* Check if we have run into a valid saved state stack now. */
+ // Check if we have run into a valid saved state stack now.
if (last_valid != NULL && lnum == last_valid->sst_lnum) {
load_current_state(last_valid);
break;
@@ -724,8 +743,9 @@ static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid)
/*
* Check if the previous line has the line-continuation pattern.
*/
- if (lnum > 1 && syn_match_linecont(lnum - 1))
+ if (lnum > 1 && syn_match_linecont(lnum - 1)) {
continue;
+ }
/*
* Start with nothing on the state stack
@@ -741,12 +761,12 @@ static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid)
if (had_sync_point && current_state.ga_len) {
cur_si = &CUR_STATE(current_state.ga_len - 1);
if (cur_si->si_m_endpos.lnum > start_lnum) {
- /* ignore match that goes to after where started */
+ // ignore match that goes to after where started
current_lnum = end_lnum;
break;
}
if (cur_si->si_idx < 0) {
- /* Cannot happen? */
+ // Cannot happen?
found_flags = 0;
found_match_idx = KEYWORD_IDX;
} else {
@@ -764,23 +784,27 @@ static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid)
if (found_m_endpos.lnum > current_lnum) {
current_lnum = found_m_endpos.lnum;
current_col = found_m_endpos.col;
- if (current_lnum >= end_lnum)
+ if (current_lnum >= end_lnum) {
break;
- } else if (found_m_endpos.col > current_col)
+ }
+ } else if (found_m_endpos.col > current_col) {
current_col = found_m_endpos.col;
- else
+ } else {
++current_col;
+ }
/* syn_current_attr() will have skipped the check for
* an item that ends here, need to do that now. Be
* careful not to go past the NUL. */
prev_current_col = current_col;
- if (syn_getcurline()[current_col] != NUL)
+ if (syn_getcurline()[current_col] != NUL) {
++current_col;
+ }
check_state_ends();
current_col = prev_current_col;
- } else
+ } else {
break;
+ }
}
}
@@ -828,7 +852,7 @@ static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid)
invalidate_current_state();
}
- /* Ran into start of the file or exceeded maximum number of lines */
+ // Ran into start of the file or exceeded maximum number of lines
if (lnum <= break_lnum) {
invalidate_current_state();
current_lnum = break_lnum + 1;
@@ -934,10 +958,13 @@ static void syn_update_ends(bool startofline)
* Then check for items ending in column 0.
*/
int i = current_state.ga_len - 1;
- if (keepend_level >= 0)
- for (; i > keepend_level; --i)
- if (CUR_STATE(i).si_flags & HL_EXTEND)
+ if (keepend_level >= 0) {
+ for (; i > keepend_level; --i) {
+ if (CUR_STATE(i).si_flags & HL_EXTEND) {
break;
+ }
+ }
+ }
bool seen_keepend = false;
for (; i < current_state.ga_len; i++) {
@@ -945,11 +972,12 @@ static void syn_update_ends(bool startofline)
if ((cur_si->si_flags & HL_KEEPEND)
|| (seen_keepend && !startofline)
|| (i == current_state.ga_len - 1 && startofline)) {
- cur_si->si_h_startpos.col = 0; /* start highl. in col 0 */
+ cur_si->si_h_startpos.col = 0; // start highl. in col 0
cur_si->si_h_startpos.lnum = current_lnum;
- if (!(cur_si->si_flags & HL_MATCHCONT))
+ if (!(cur_si->si_flags & HL_MATCHCONT)) {
update_si_end(cur_si, (int)current_col, !startofline);
+ }
if (!startofline && (cur_si->si_flags & HL_KEEPEND)) {
seen_keepend = true;
@@ -997,7 +1025,7 @@ static void syn_update_ends(bool startofline)
static void syn_stack_free_block(synblock_T *block)
{
- synstate_T *p;
+ synstate_T *p;
if (block->b_sst_array != NULL) {
for (p = block->b_sst_first; p != NULL; p = p->sst_next) {
@@ -1016,7 +1044,7 @@ void syn_stack_free_all(synblock_T *block)
{
syn_stack_free_block(block);
- /* When using "syntax" fold method, must update all folds. */
+ // When using "syntax" fold method, must update all folds.
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
if (wp->w_s == block && foldmethodIsSyntax(wp)) {
foldUpdateAll(wp);
@@ -1033,31 +1061,35 @@ void syn_stack_free_all(synblock_T *block)
static void syn_stack_alloc(void)
{
long len;
- synstate_T *to, *from;
- synstate_T *sstp;
+ synstate_T *to, *from;
+ synstate_T *sstp;
len = syn_buf->b_ml.ml_line_count / SST_DIST + Rows * 2;
- if (len < SST_MIN_ENTRIES)
+ if (len < SST_MIN_ENTRIES) {
len = SST_MIN_ENTRIES;
- else if (len > SST_MAX_ENTRIES)
+ } else if (len > SST_MAX_ENTRIES) {
len = SST_MAX_ENTRIES;
+ }
if (syn_block->b_sst_len > len * 2 || syn_block->b_sst_len < len) {
- /* Allocate 50% too much, to avoid reallocating too often. */
+ // Allocate 50% too much, to avoid reallocating too often.
len = syn_buf->b_ml.ml_line_count;
len = (len + len / 2) / SST_DIST + Rows * 2;
- if (len < SST_MIN_ENTRIES)
+ if (len < SST_MIN_ENTRIES) {
len = SST_MIN_ENTRIES;
- else if (len > SST_MAX_ENTRIES)
+ } else if (len > SST_MAX_ENTRIES) {
len = SST_MAX_ENTRIES;
+ }
if (syn_block->b_sst_array != NULL) {
/* When shrinking the array, cleanup the existing stack.
* Make sure that all valid entries fit in the new array. */
while (syn_block->b_sst_len - syn_block->b_sst_freecount + 2 > len
- && syn_stack_cleanup())
+ && syn_stack_cleanup()) {
;
- if (len < syn_block->b_sst_len - syn_block->b_sst_freecount + 2)
+ }
+ if (len < syn_block->b_sst_len - syn_block->b_sst_freecount + 2) {
len = syn_block->b_sst_len - syn_block->b_sst_freecount + 2;
+ }
}
assert(len >= 0);
@@ -1065,7 +1097,7 @@ static void syn_stack_alloc(void)
to = sstp - 1;
if (syn_block->b_sst_array != NULL) {
- /* Move the states from the old array to the new one. */
+ // Move the states from the old array to the new one.
for (from = syn_block->b_sst_first; from != NULL;
from = from->sst_next) {
++to;
@@ -1082,10 +1114,11 @@ static void syn_stack_alloc(void)
syn_block->b_sst_freecount = len;
}
- /* Create the list of free entries. */
+ // Create the list of free entries.
syn_block->b_sst_firstfree = to + 1;
- while (++to < sstp + len)
+ while (++to < sstp + len) {
to->sst_next = to + 1;
+ }
(sstp + len - 1)->sst_next = NULL;
xfree(syn_block->b_sst_array);
@@ -1113,7 +1146,7 @@ void syn_stack_apply_changes(buf_T *buf)
static void syn_stack_apply_changes_block(synblock_T *block, buf_T *buf)
{
- synstate_T *p, *prev, *np;
+ synstate_T *p, *prev, *np;
linenr_T n;
prev = NULL;
@@ -1121,12 +1154,13 @@ static void syn_stack_apply_changes_block(synblock_T *block, buf_T *buf)
if (p->sst_lnum + block->b_syn_sync_linebreaks > buf->b_mod_top) {
n = p->sst_lnum + buf->b_mod_xlines;
if (n <= buf->b_mod_bot) {
- /* this state is inside the changed area, remove it */
+ // this state is inside the changed area, remove it
np = p->sst_next;
- if (prev == NULL)
+ if (prev == NULL) {
block->b_sst_first = np;
- else
+ } else {
prev->sst_next = np;
+ }
syn_stack_free_entry(block, p);
p = np;
continue;
@@ -1135,14 +1169,16 @@ static void syn_stack_apply_changes_block(synblock_T *block, buf_T *buf)
* that needs to be parsed before this entry can be made valid
* again. */
if (p->sst_change_lnum != 0 && p->sst_change_lnum > buf->b_mod_top) {
- if (p->sst_change_lnum + buf->b_mod_xlines > buf->b_mod_top)
+ if (p->sst_change_lnum + buf->b_mod_xlines > buf->b_mod_top) {
p->sst_change_lnum += buf->b_mod_xlines;
- else
+ } else {
p->sst_change_lnum = buf->b_mod_top;
+ }
}
if (p->sst_change_lnum == 0
- || p->sst_change_lnum < buf->b_mod_bot)
+ || p->sst_change_lnum < buf->b_mod_bot) {
p->sst_change_lnum = buf->b_mod_bot;
+ }
p->sst_lnum = n;
}
@@ -1156,7 +1192,7 @@ static void syn_stack_apply_changes_block(synblock_T *block, buf_T *buf)
/// @return true if at least one entry was freed.
static bool syn_stack_cleanup(void)
{
- synstate_T *p, *prev;
+ synstate_T *p, *prev;
disptick_T tick;
int dist;
bool retval = false;
@@ -1165,11 +1201,12 @@ static bool syn_stack_cleanup(void)
return retval;
}
- /* Compute normal distance between non-displayed entries. */
- if (syn_block->b_sst_len <= Rows)
+ // Compute normal distance between non-displayed entries.
+ if (syn_block->b_sst_len <= Rows) {
dist = 999999;
- else
+ } else {
dist = syn_buf->b_ml.ml_line_count / (syn_block->b_sst_len - Rows) + 1;
+ }
/*
* Go through the list to find the "tick" for the oldest entry that can
@@ -1182,8 +1219,9 @@ static bool syn_stack_cleanup(void)
for (p = prev->sst_next; p != NULL; prev = p, p = p->sst_next) {
if (prev->sst_lnum + dist > p->sst_lnum) {
if (p->sst_tick > syn_block->b_sst_lasttick) {
- if (!above || p->sst_tick < tick)
+ if (!above || p->sst_tick < tick) {
tick = p->sst_tick;
+ }
above = true;
} else if (!above && p->sst_tick < tick) {
tick = p->sst_tick;
@@ -1198,7 +1236,7 @@ static bool syn_stack_cleanup(void)
prev = syn_block->b_sst_first;
for (p = prev->sst_next; p != NULL; prev = p, p = p->sst_next) {
if (p->sst_tick == tick && prev->sst_lnum + dist > p->sst_lnum) {
- /* Move this entry from used list to free list */
+ // Move this entry from used list to free list
prev->sst_next = p->sst_next;
syn_stack_free_entry(syn_block, p);
p = prev;
@@ -1226,14 +1264,16 @@ static void syn_stack_free_entry(synblock_T *block, synstate_T *p)
*/
static synstate_T *syn_stack_find_entry(linenr_T lnum)
{
- synstate_T *p, *prev;
+ synstate_T *p, *prev;
prev = NULL;
for (p = syn_block->b_sst_first; p != NULL; prev = p, p = p->sst_next) {
- if (p->sst_lnum == lnum)
+ if (p->sst_lnum == lnum) {
return p;
- if (p->sst_lnum > lnum)
+ }
+ if (p->sst_lnum > lnum) {
break;
+ }
}
return prev;
}
@@ -1245,10 +1285,10 @@ static synstate_T *syn_stack_find_entry(linenr_T lnum)
static synstate_T *store_current_state(void)
{
int i;
- synstate_T *p;
- bufstate_T *bp;
+ synstate_T *p;
+ bufstate_T *bp;
stateitem_T *cur_si;
- synstate_T *sp = syn_stack_find_entry(current_lnum);
+ synstate_T *sp = syn_stack_find_entry(current_lnum);
/*
* If the current state contains a start or end pattern that continues
@@ -1260,51 +1300,55 @@ static synstate_T *store_current_state(void)
|| cur_si->si_m_endpos.lnum >= current_lnum
|| cur_si->si_h_endpos.lnum >= current_lnum
|| (cur_si->si_end_idx
- && cur_si->si_eoe_pos.lnum >= current_lnum))
+ && cur_si->si_eoe_pos.lnum >= current_lnum)) {
break;
+ }
}
if (i >= 0) {
if (sp != NULL) {
- /* find "sp" in the list and remove it */
- if (syn_block->b_sst_first == sp)
- /* it's the first entry */
+ // find "sp" in the list and remove it
+ if (syn_block->b_sst_first == sp) {
+ // it's the first entry
syn_block->b_sst_first = sp->sst_next;
- else {
- /* find the entry just before this one to adjust sst_next */
- for (p = syn_block->b_sst_first; p != NULL; p = p->sst_next)
- if (p->sst_next == sp)
+ } else {
+ // find the entry just before this one to adjust sst_next
+ for (p = syn_block->b_sst_first; p != NULL; p = p->sst_next) {
+ if (p->sst_next == sp) {
break;
- if (p != NULL) /* just in case */
+ }
+ }
+ if (p != NULL) { // just in case
p->sst_next = sp->sst_next;
+ }
}
syn_stack_free_entry(syn_block, sp);
sp = NULL;
}
- } else if (sp == NULL || sp->sst_lnum != current_lnum) {
+ } else if (sp == NULL || sp->sst_lnum != current_lnum) {
/*
* Add a new entry
*/
- /* If no free items, cleanup the array first. */
+ // If no free items, cleanup the array first.
if (syn_block->b_sst_freecount == 0) {
(void)syn_stack_cleanup();
- /* "sp" may have been moved to the freelist now */
+ // "sp" may have been moved to the freelist now
sp = syn_stack_find_entry(current_lnum);
}
- /* Still no free items? Must be a strange problem... */
- if (syn_block->b_sst_freecount == 0)
+ // Still no free items? Must be a strange problem...
+ if (syn_block->b_sst_freecount == 0) {
sp = NULL;
- else {
+ } else {
/* Take the first item from the free list and put it in the used
* list, after *sp */
p = syn_block->b_sst_firstfree;
syn_block->b_sst_firstfree = p->sst_next;
--syn_block->b_sst_freecount;
if (sp == NULL) {
- /* Insert in front of the list */
+ // Insert in front of the list
p->sst_next = syn_block->b_sst_first;
syn_block->b_sst_first = p;
} else {
- /* insert in list after *sp */
+ // insert in list after *sp
p->sst_next = sp->sst_next;
sp->sst_next = p;
}
@@ -1314,7 +1358,7 @@ static synstate_T *store_current_state(void)
}
}
if (sp != NULL) {
- /* When overwriting an existing state stack, clear it first */
+ // When overwriting an existing state stack, clear it first
clear_syn_state(sp);
sp->sst_stacksize = current_state.ga_len;
if (current_state.ga_len > SST_FIX_STATES) {
@@ -1324,8 +1368,9 @@ static synstate_T *store_current_state(void)
ga_grow(&sp->sst_union.sst_ga, current_state.ga_len);
sp->sst_union.sst_ga.ga_len = current_state.ga_len;
bp = SYN_STATE_P(&(sp->sst_union.sst_ga));
- } else
+ } else {
bp = sp->sst_union.sst_stack;
+ }
for (i = 0; i < sp->sst_stacksize; ++i) {
bp[i].bs_idx = CUR_STATE(i).si_idx;
bp[i].bs_flags = CUR_STATE(i).si_flags;
@@ -1348,32 +1393,35 @@ static synstate_T *store_current_state(void)
static void load_current_state(synstate_T *from)
{
int i;
- bufstate_T *bp;
+ bufstate_T *bp;
clear_current_state();
validate_current_state();
keepend_level = -1;
if (from->sst_stacksize) {
ga_grow(&current_state, from->sst_stacksize);
- if (from->sst_stacksize > SST_FIX_STATES)
+ if (from->sst_stacksize > SST_FIX_STATES) {
bp = SYN_STATE_P(&(from->sst_union.sst_ga));
- else
+ } else {
bp = from->sst_union.sst_stack;
+ }
for (i = 0; i < from->sst_stacksize; ++i) {
CUR_STATE(i).si_idx = bp[i].bs_idx;
CUR_STATE(i).si_flags = bp[i].bs_flags;
CUR_STATE(i).si_seqnr = bp[i].bs_seqnr;
CUR_STATE(i).si_cchar = bp[i].bs_cchar;
CUR_STATE(i).si_extmatch = ref_extmatch(bp[i].bs_extmatch);
- if (keepend_level < 0 && (CUR_STATE(i).si_flags & HL_KEEPEND))
+ if (keepend_level < 0 && (CUR_STATE(i).si_flags & HL_KEEPEND)) {
keepend_level = i;
+ }
CUR_STATE(i).si_ends = FALSE;
CUR_STATE(i).si_m_lnum = 0;
- if (CUR_STATE(i).si_idx >= 0)
+ if (CUR_STATE(i).si_idx >= 0) {
CUR_STATE(i).si_next_list =
(SYN_ITEMS(syn_block)[CUR_STATE(i).si_idx]).sp_next_list;
- else
+ } else {
CUR_STATE(i).si_next_list = NULL;
+ }
update_si_attr(i);
}
current_state.ga_len = from->sst_stacksize;
@@ -1388,26 +1436,28 @@ static void load_current_state(synstate_T *from)
/// @return true when they are equal.
static bool syn_stack_equal(synstate_T *sp)
{
- bufstate_T *bp;
- reg_extmatch_T *six, *bsx;
+ bufstate_T *bp;
+ reg_extmatch_T *six, *bsx;
- /* First a quick check if the stacks have the same size end nextlist. */
+ // First a quick check if the stacks have the same size end nextlist.
if (sp->sst_stacksize != current_state.ga_len
|| sp->sst_next_list != current_next_list) {
return false;
}
- /* Need to compare all states on both stacks. */
- if (sp->sst_stacksize > SST_FIX_STATES)
+ // Need to compare all states on both stacks.
+ if (sp->sst_stacksize > SST_FIX_STATES) {
bp = SYN_STATE_P(&(sp->sst_union.sst_ga));
- else
+ } else {
bp = sp->sst_union.sst_stack;
+ }
int i;
for (i = current_state.ga_len; --i >= 0; ) {
- /* If the item has another index the state is different. */
- if (bp[i].bs_idx != CUR_STATE(i).si_idx)
+ // If the item has another index the state is different.
+ if (bp[i].bs_idx != CUR_STATE(i).si_idx) {
break;
+ }
if (bp[i].bs_extmatch == CUR_STATE(i).si_extmatch) {
continue;
}
@@ -1418,8 +1468,9 @@ static bool syn_stack_equal(synstate_T *sp)
six = CUR_STATE(i).si_extmatch;
/* If one of the extmatch pointers is NULL the states are
* different. */
- if (bsx == NULL || six == NULL)
+ if (bsx == NULL || six == NULL) {
break;
+ }
int j;
for (j = 0; j < NSUBEXP; ++j) {
/* Check each referenced match string. They must all be
@@ -1438,8 +1489,9 @@ static bool syn_stack_equal(synstate_T *sp)
}
}
}
- if (j != NSUBEXP)
+ if (j != NSUBEXP) {
break;
+ }
}
if (i < 0) {
return true;
@@ -1453,21 +1505,23 @@ static bool syn_stack_equal(synstate_T *sp)
* this line depended on a change before it, it now depends on the line below
* the last parsed line.
* The window looks like this:
- * line which changed
- * displayed line
- * displayed line
+ * line which changed
+ * displayed line
+ * displayed line
* lnum -> line below window
*/
void syntax_end_parsing(linenr_T lnum)
{
- synstate_T *sp;
+ synstate_T *sp;
sp = syn_stack_find_entry(lnum);
- if (sp != NULL && sp->sst_lnum < lnum)
+ if (sp != NULL && sp->sst_lnum < lnum) {
sp = sp->sst_next;
+ }
- if (sp != NULL && sp->sst_change_lnum != 0)
+ if (sp != NULL && sp->sst_change_lnum != 0) {
sp->sst_change_lnum = lnum;
+ }
}
/*
@@ -1477,7 +1531,7 @@ void syntax_end_parsing(linenr_T lnum)
static void invalidate_current_state(void)
{
clear_current_state();
- current_state.ga_itemsize = 0; /* mark current_state invalid */
+ current_state.ga_itemsize = 0; // mark current_state invalid
current_next_list = NULL;
keepend_level = -1;
}
@@ -1495,7 +1549,7 @@ static void validate_current_state(void)
bool syntax_check_changed(linenr_T lnum)
{
bool retval = true;
- synstate_T *sp;
+ synstate_T *sp;
/*
* Check the state stack when:
@@ -1532,16 +1586,13 @@ bool syntax_check_changed(linenr_T lnum)
return retval;
}
-/*
- * Finish the current line.
- * This doesn't return any attributes, it only gets the state at the end of
- * the line. It can start anywhere in the line, as long as the current state
- * is valid.
- */
-static bool
-syn_finish_line(
- const bool syncing // called for syncing
-)
+/// Finish the current line.
+/// This doesn't return any attributes, it only gets the state at the end of
+/// the line. It can start anywhere in the line, as long as the current state
+/// is valid.
+///
+/// @param syncing called for syncing
+static bool syn_finish_line(const bool syncing)
{
while (!current_finished) {
(void)syn_current_attr(syncing, false, NULL, false);
@@ -1571,36 +1622,35 @@ syn_finish_line(
return false;
}
-/*
- * Return highlight attributes for next character.
- * Must first call syntax_start() once for the line.
- * "col" is normally 0 for the first use in a line, and increments by one each
- * time. It's allowed to skip characters and to stop before the end of the
- * line. But only a "col" after a previously used column is allowed.
- * When "can_spell" is not NULL set it to TRUE when spell-checking should be
- * done.
- */
-int
-get_syntax_attr(
- const colnr_T col,
- bool *const can_spell,
- const bool keep_state // keep state of char at "col"
-)
+/// Gets highlight attributes for next character.
+/// Must first call syntax_start() once for the line.
+/// "col" is normally 0 for the first use in a line, and increments by one each
+/// time. It's allowed to skip characters and to stop before the end of the
+/// line. But only a "col" after a previously used column is allowed.
+/// When "can_spell" is not NULL set it to TRUE when spell-checking should be
+/// done.
+///
+/// @param keep_state keep state of char at "col"
+///
+/// @return highlight attributes for next character.
+int get_syntax_attr(const colnr_T col, bool *const can_spell, const bool keep_state)
{
int attr = 0;
- if (can_spell != NULL)
+ if (can_spell != NULL) {
/* Default: Only do spelling when there is no @Spell cluster or when
* ":syn spell toplevel" was used. */
*can_spell = syn_block->b_syn_spell == SYNSPL_DEFAULT
? (syn_block->b_spell_cluster_id == 0)
: (syn_block->b_syn_spell == SYNSPL_TOP);
+ }
- /* check for out of memory situation */
- if (syn_block->b_sst_array == NULL)
+ // check for out of memory situation
+ if (syn_block->b_sst_array == NULL) {
return 0;
+ }
- /* After 'synmaxcol' the attribute is always zero. */
+ // After 'synmaxcol' the attribute is always zero.
if (syn_buf->b_p_smc > 0 && col >= (colnr_T)syn_buf->b_p_smc) {
clear_current_state();
current_id = 0;
@@ -1610,9 +1660,10 @@ get_syntax_attr(
return 0;
}
- /* Make sure current_state is valid */
- if (INVALID_STATE(&current_state))
+ // Make sure current_state is valid
+ if (INVALID_STATE(&current_state)) {
validate_current_state();
+ }
/*
* Skip from the current column to "col", get the attributes for "col".
@@ -1626,15 +1677,14 @@ get_syntax_attr(
return attr;
}
-/*
- * Get syntax attributes for current_lnum, current_col.
- */
-static int syn_current_attr(
- const bool syncing, // When true: called for syncing
- const bool displaying, // result will be displayed
- bool *const can_spell, // return: do spell checking
- const bool keep_state // keep syntax stack afterwards
-)
+/// Get syntax attributes for current_lnum, current_col.
+///
+/// @param syncing When true: called for syncing
+/// @param displaying result will be displayed
+/// @param can_spell return: do spell checking
+/// @param keep_state keep syntax stack afterwards
+static int syn_current_attr(const bool syncing, const bool displaying, bool *const can_spell,
+ const bool keep_state)
{
lpos_T endpos; // was: char_u *endp;
lpos_T hl_startpos; // was: int hl_startcol;
@@ -1654,8 +1704,8 @@ static int syn_current_attr(
lpos_T pos;
reg_extmatch_T *cur_extmatch = NULL;
char_u buf_chartab[32]; // chartab array for syn iskeyword
- char_u *line; // current line. NOTE: becomes invalid after
- // looking for a pattern match!
+ char_u *line; // current line. NOTE: becomes invalid after
+ // looking for a pattern match!
// variables for zero-width matches that have a "nextgroup" argument
bool keep_next_list;
@@ -1681,7 +1731,7 @@ static int syn_current_attr(
return 0;
}
- /* if the current or next character is NUL, we will finish the line now */
+ // if the current or next character is NUL, we will finish the line now
if (line[current_col] == NUL || line[current_col + 1] == NUL) {
current_finished = true;
current_state_stored = false;
@@ -1699,8 +1749,8 @@ static int syn_current_attr(
// Only check for keywords when not syncing and there are some.
const bool do_keywords = !syncing
- && (syn_block->b_keywtab.ht_used > 0
- || syn_block->b_keywtab_ic.ht_used > 0);
+ && (syn_block->b_keywtab.ht_used > 0
+ || syn_block->b_keywtab_ic.ht_used > 0);
/* Init the list of zero-width matches with a nextlist. This is used to
* avoid matching the same item in the same position twice. */
@@ -1726,23 +1776,25 @@ static int syn_current_attr(
* Always need to check for contained items if some item has the
* "containedin" argument (takes extra time!).
*/
- if (current_state.ga_len)
+ if (current_state.ga_len) {
cur_si = &CUR_STATE(current_state.ga_len - 1);
- else
+ } else {
cur_si = NULL;
+ }
if (syn_block->b_syn_containedin || cur_si == NULL
|| cur_si->si_cont_list != NULL) {
/*
* 2. Check for keywords, if on a keyword char after a non-keyword
- * char. Don't do this when syncing.
+ * char. Don't do this when syncing.
*/
if (do_keywords) {
line = syn_getcurline();
const char_u *cur_pos = line + current_col;
if (vim_iswordp_buf(cur_pos, syn_buf)
- && (current_col == 0 || !vim_iswordp_buf(
- cur_pos - 1 - utf_head_off(line, cur_pos - 1), syn_buf))) {
+ && (current_col == 0 ||
+ !vim_iswordp_buf(cur_pos - 1 - utf_head_off(line, cur_pos - 1),
+ syn_buf))) {
syn_id = check_keyword_id(line, (int)current_col, &endcol, &flags,
&next_list, cur_si, &cchar);
if (syn_id != 0) {
@@ -1751,7 +1803,7 @@ static int syn_current_attr(
cur_si = &CUR_STATE(current_state.ga_len - 1);
cur_si->si_m_startcol = current_col;
cur_si->si_h_startpos.lnum = current_lnum;
- cur_si->si_h_startpos.col = 0; /* starts right away */
+ cur_si->si_h_startpos.col = 0; // starts right away
cur_si->si_m_endpos.lnum = current_lnum;
cur_si->si_m_endpos.col = endcol;
cur_si->si_h_endpos.lnum = current_lnum;
@@ -1761,10 +1813,11 @@ static int syn_current_attr(
cur_si->si_flags = flags;
cur_si->si_seqnr = next_seqnr++;
cur_si->si_cchar = cchar;
- if (current_state.ga_len > 1)
+ if (current_state.ga_len > 1) {
cur_si->si_flags |=
CUR_STATE(current_state.ga_len - 2).si_flags
& HL_CONCEAL;
+ }
cur_si->si_id = syn_id;
cur_si->si_trans_id = syn_id;
if (flags & HL_TRANSP) {
@@ -1772,10 +1825,8 @@ static int syn_current_attr(
cur_si->si_attr = 0;
cur_si->si_trans_id = 0;
} else {
- cur_si->si_attr = CUR_STATE(
- current_state.ga_len - 2).si_attr;
- cur_si->si_trans_id = CUR_STATE(
- current_state.ga_len - 2).si_trans_id;
+ cur_si->si_attr = CUR_STATE(current_state.ga_len - 2).si_attr;
+ cur_si->si_trans_id = CUR_STATE(current_state.ga_len - 2).si_trans_id;
}
} else {
cur_si->si_attr = syn_id2attr(syn_id);
@@ -1803,28 +1854,29 @@ static int syn_current_attr(
* pattern takes quite a bit of time, thus we want to
* avoid doing it when it's not needed.
*/
- next_match_idx = 0; /* no match in this line yet */
+ next_match_idx = 0; // no match in this line yet
next_match_col = MAXCOL;
for (int idx = syn_block->b_syn_patterns.ga_len; --idx >= 0; ) {
synpat_T *const spp = &(SYN_ITEMS(syn_block)[idx]);
- if ( spp->sp_syncing == syncing
- && (displaying || !(spp->sp_flags & HL_DISPLAY))
- && (spp->sp_type == SPTYPE_MATCH
- || spp->sp_type == SPTYPE_START)
- && (current_next_list != NULL
+ if (spp->sp_syncing == syncing
+ && (displaying || !(spp->sp_flags & HL_DISPLAY))
+ && (spp->sp_type == SPTYPE_MATCH
+ || spp->sp_type == SPTYPE_START)
+ && (current_next_list != NULL
? in_id_list(NULL, current_next_list,
- &spp->sp_syn, 0)
+ &spp->sp_syn, 0)
: (cur_si == NULL
? !(spp->sp_flags & HL_CONTAINED)
: in_id_list(cur_si,
- cur_si->si_cont_list, &spp->sp_syn,
- spp->sp_flags & HL_CONTAINED)))) {
+ cur_si->si_cont_list, &spp->sp_syn,
+ spp->sp_flags & HL_CONTAINED)))) {
/* If we already tried matching in this line, and
* there isn't a match before next_match_col, skip
* this item. */
if (spp->sp_line_id == current_line_id
- && spp->sp_startcol >= next_match_col)
+ && spp->sp_startcol >= next_match_col) {
continue;
+ }
spp->sp_line_id = current_line_id;
colnr_T lc_col = current_col - spp->sp_offsets[SPO_LC_OFF];
@@ -1838,7 +1890,7 @@ static int syn_current_attr(
IF_SYN_TIME(&spp->sp_time));
spp->sp_prog = regmatch.regprog;
if (!r) {
- /* no match in this line, try another one */
+ // no match in this line, try another one
spp->sp_startcol = MAXCOL;
continue;
}
@@ -1847,7 +1899,7 @@ static int syn_current_attr(
* Compute the first column of the match.
*/
syn_add_start_off(&pos, &regmatch,
- spp, SPO_MS_OFF, -1);
+ spp, SPO_MS_OFF, -1);
if (pos.lnum > current_lnum) {
/* must have used end of match in a next line,
* we can't handle that */
@@ -1864,8 +1916,9 @@ static int syn_current_attr(
* If a previously found match starts at a lower
* column number, don't use this one.
*/
- if (startcol >= next_match_col)
+ if (startcol >= next_match_col) {
continue;
+ }
/*
* If we matched this pattern at this position
@@ -1880,14 +1933,14 @@ static int syn_current_attr(
endpos.lnum = regmatch.endpos[0].lnum;
endpos.col = regmatch.endpos[0].col;
- /* Compute the highlight start. */
+ // Compute the highlight start.
syn_add_start_off(&hl_startpos, &regmatch,
- spp, SPO_HS_OFF, -1);
+ spp, SPO_HS_OFF, -1);
- /* Compute the region start. */
- /* Default is to use the end of the match. */
+ // Compute the region start.
+ // Default is to use the end of the match.
syn_add_end_off(&eos_pos, &regmatch,
- spp, SPO_RS_OFF, 0);
+ spp, SPO_RS_OFF, 0);
/*
* Grab the external submatches before they get
@@ -1898,7 +1951,7 @@ static int syn_current_attr(
re_extmatch_out = NULL;
flags = 0;
- eoe_pos.lnum = 0; /* avoid warning */
+ eoe_pos.lnum = 0; // avoid warning
eoe_pos.col = 0;
end_idx = 0;
hl_endpos.lnum = 0;
@@ -1915,9 +1968,10 @@ static int syn_current_attr(
startpos = endpos;
find_endpos(idx, &startpos, &endpos, &hl_endpos,
- &flags, &eoe_pos, &end_idx, cur_extmatch);
- if (endpos.lnum == 0)
- continue; /* not found */
+ &flags, &eoe_pos, &end_idx, cur_extmatch);
+ if (endpos.lnum == 0) {
+ continue; // not found
+ }
}
/*
* For a "match" the size must be > 0 after the
@@ -1926,9 +1980,9 @@ static int syn_current_attr(
*/
else if (spp->sp_type == SPTYPE_MATCH) {
syn_add_end_off(&hl_endpos, &regmatch, spp,
- SPO_HE_OFF, 0);
+ SPO_HE_OFF, 0);
syn_add_end_off(&endpos, &regmatch, spp,
- SPO_ME_OFF, 0);
+ SPO_ME_OFF, 0);
if (endpos.lnum == current_lnum
&& (int)endpos.col + syncing < startcol) {
/*
@@ -1948,8 +2002,9 @@ static int syn_current_attr(
/* Highlighting must start after startpos and end
* before endpos. */
if (hl_startpos.lnum == current_lnum
- && (int)hl_startpos.col < startcol)
+ && (int)hl_startpos.col < startcol) {
hl_startpos.col = startcol;
+ }
limit_pos_zero(&hl_endpos, &endpos);
next_match_idx = idx;
@@ -1972,7 +2027,7 @@ static int syn_current_attr(
* If we found a match at the current column, use it.
*/
if (next_match_idx >= 0 && next_match_col == (int)current_col) {
- synpat_T *lspp;
+ synpat_T *lspp;
/* When a zero-width item matched which has a nextgroup,
* don't push the item but set nextgroup. */
@@ -2012,8 +2067,9 @@ static int syn_current_attr(
if (((current_next_flags & HL_SKIPWHITE)
&& ascii_iswhite(line[current_col]))
|| ((current_next_flags & HL_SKIPEMPTY)
- && *line == NUL))
+ && *line == NUL)) {
break;
+ }
}
/*
@@ -2030,7 +2086,6 @@ static int syn_current_attr(
found_match = true;
}
}
-
} while (found_match);
restore_chartab(buf_chartab);
@@ -2075,9 +2130,9 @@ static int syn_current_attr(
/* There is no @Spell cluster: Do spelling for items without
* @NoSpell cluster. */
if (syn_block->b_nospell_cluster_id == 0
- || current_trans_id == 0)
+ || current_trans_id == 0) {
*can_spell = (syn_block->b_syn_spell != SYNSPL_NOTOP);
- else {
+ } else {
sps.inc_tag = 0;
sps.id = syn_block->b_nospell_cluster_id;
sps.cont_in_list = NULL;
@@ -2088,9 +2143,9 @@ static int syn_current_attr(
* the @Spell cluster. But not when @NoSpell is also there.
* At the toplevel only spell check when ":syn spell toplevel"
* was used. */
- if (current_trans_id == 0)
+ if (current_trans_id == 0) {
*can_spell = (syn_block->b_syn_spell == SYNSPL_TOP);
- else {
+ } else {
sps.inc_tag = 0;
sps.id = syn_block->b_spell_cluster_id;
sps.cont_in_list = NULL;
@@ -2098,8 +2153,9 @@ static int syn_current_attr(
if (syn_block->b_nospell_cluster_id != 0) {
sps.id = syn_block->b_nospell_cluster_id;
- if (in_id_list(sip, sip->si_cont_list, &sps, 0))
+ if (in_id_list(sip, sip->si_cont_list, &sps, 0)) {
*can_spell = false;
+ }
}
}
}
@@ -2123,14 +2179,15 @@ static int syn_current_attr(
--current_col;
}
}
- } else if (can_spell != NULL)
+ } else if (can_spell != NULL) {
/* Default: Only do spelling when there is no @Spell cluster or when
* ":syn spell toplevel" was used. */
*can_spell = syn_block->b_syn_spell == SYNSPL_DEFAULT
? (syn_block->b_spell_cluster_id == 0)
: (syn_block->b_syn_spell == SYNSPL_TOP);
+ }
- /* nextgroup ends at end of line, unless "skipnl" or "skipempty" present */
+ // nextgroup ends at end of line, unless "skipnl" or "skipempty" present
if (current_next_list != NULL
&& (line = syn_getcurline())[current_col] != NUL
&& line[current_col + 1] == NUL
@@ -2138,10 +2195,11 @@ static int syn_current_attr(
current_next_list = NULL;
}
- if (!GA_EMPTY(&zero_width_next_ga))
+ if (!GA_EMPTY(&zero_width_next_ga)) {
ga_clear(&zero_width_next_ga);
+ }
- /* No longer need external matches. But keep next_match_extmatch. */
+ // No longer need external matches. But keep next_match_extmatch.
unref_extmatch(re_extmatch_out);
re_extmatch_out = NULL;
unref_extmatch(cur_extmatch);
@@ -2199,9 +2257,10 @@ static stateitem_T *push_next_match(void)
cur_si->si_flags = spp->sp_flags;
cur_si->si_seqnr = next_seqnr++;
cur_si->si_cchar = spp->sp_cchar;
- if (current_state.ga_len > 1)
+ if (current_state.ga_len > 1) {
cur_si->si_flags |=
CUR_STATE(current_state.ga_len - 2).si_flags & HL_CONCEAL;
+ }
cur_si->si_next_list = spp->sp_next_list;
cur_si->si_extmatch = ref_extmatch(next_match_extmatch);
if (spp->sp_type == SPTYPE_START && !(spp->sp_flags & HL_ONELINE)) {
@@ -2216,8 +2275,9 @@ static stateitem_T *push_next_match(void)
cur_si->si_eoe_pos = next_match_eoe_pos;
cur_si->si_end_idx = next_match_end_idx;
}
- if (keepend_level < 0 && (cur_si->si_flags & HL_KEEPEND))
+ if (keepend_level < 0 && (cur_si->si_flags & HL_KEEPEND)) {
keepend_level = current_state.ga_len - 1;
+ }
check_keepend();
update_si_attr(current_state.ga_len - 1);
@@ -2239,15 +2299,16 @@ static stateitem_T *push_next_match(void)
cur_si->si_flags = HL_MATCH;
cur_si->si_seqnr = next_seqnr++;
cur_si->si_flags |= save_flags;
- if (cur_si->si_flags & HL_CONCEALENDS)
+ if (cur_si->si_flags & HL_CONCEALENDS) {
cur_si->si_flags |= HL_CONCEAL;
+ }
cur_si->si_next_list = NULL;
check_keepend();
update_si_attr(current_state.ga_len - 1);
}
}
- next_match_idx = -1; /* try other match next time */
+ next_match_idx = -1; // try other match next time
return cur_si;
}
@@ -2282,14 +2343,15 @@ static void check_state_ends(void)
cur_si->si_h_endpos = cur_si->si_eoe_pos;
cur_si->si_flags |= HL_MATCH;
cur_si->si_seqnr = next_seqnr++;
- if (cur_si->si_flags & HL_CONCEALENDS)
+ if (cur_si->si_flags & HL_CONCEALENDS) {
cur_si->si_flags |= HL_CONCEAL;
+ }
update_si_attr(current_state.ga_len - 1);
- /* nextgroup= should not match in the end pattern */
+ // nextgroup= should not match in the end pattern
current_next_list = NULL;
- /* what matches next may be different now, clear it */
+ // what matches next may be different now, clear it
next_match_idx = 0;
next_match_col = MAXCOL;
break;
@@ -2299,8 +2361,9 @@ static void check_state_ends(void)
current_next_list = cur_si->si_next_list;
current_next_flags = cur_si->si_flags;
if (!(current_next_flags & (HL_SKIPNL | HL_SKIPEMPTY))
- && syn_getcurline()[current_col] == NUL)
+ && syn_getcurline()[current_col] == NUL) {
current_next_list = NULL;
+ }
/* When the ended item has "extend", another item with
* "keepend" now needs to check for its end. */
@@ -2308,8 +2371,9 @@ static void check_state_ends(void)
pop_current_state();
- if (GA_EMPTY(&current_state))
+ if (GA_EMPTY(&current_state)) {
break;
+ }
if (had_extend && keepend_level >= 0) {
syn_update_ends(false);
@@ -2337,12 +2401,14 @@ static void check_state_ends(void)
check_keepend();
if ((current_next_flags & HL_HAS_EOL)
&& keepend_level < 0
- && syn_getcurline()[current_col] == NUL)
+ && syn_getcurline()[current_col] == NUL) {
break;
+ }
}
}
- } else
+ } else {
break;
+ }
}
}
@@ -2353,23 +2419,26 @@ static void check_state_ends(void)
static void update_si_attr(int idx)
{
stateitem_T *sip = &CUR_STATE(idx);
- synpat_T *spp;
+ synpat_T *spp;
- /* This should not happen... */
- if (sip->si_idx < 0)
+ // This should not happen...
+ if (sip->si_idx < 0) {
return;
+ }
spp = &(SYN_ITEMS(syn_block)[sip->si_idx]);
- if (sip->si_flags & HL_MATCH)
+ if (sip->si_flags & HL_MATCH) {
sip->si_id = spp->sp_syn_match_id;
- else
+ } else {
sip->si_id = spp->sp_syn.id;
+ }
sip->si_attr = syn_id2attr(sip->si_id);
sip->si_trans_id = sip->si_id;
- if (sip->si_flags & HL_MATCH)
+ if (sip->si_flags & HL_MATCH) {
sip->si_cont_list = NULL;
- else
+ } else {
sip->si_cont_list = spp->sp_cont_list;
+ }
/*
* For transparent items, take attr from outer item.
@@ -2380,8 +2449,9 @@ static void update_si_attr(int idx)
if (idx == 0) {
sip->si_attr = 0;
sip->si_trans_id = 0;
- if (sip->si_cont_list == NULL)
+ if (sip->si_cont_list == NULL) {
sip->si_cont_list = ID_LIST_ALL;
+ }
} else {
sip->si_attr = CUR_STATE(idx - 1).si_attr;
sip->si_trans_id = CUR_STATE(idx - 1).si_trans_id;
@@ -2410,17 +2480,20 @@ static void check_keepend(void)
* This check can consume a lot of time; only do it from the level where
* there really is a keepend.
*/
- if (keepend_level < 0)
+ if (keepend_level < 0) {
return;
+ }
/*
* Find the last index of an "extend" item. "keepend" items before that
* won't do anything. If there is no "extend" item "i" will be
* "keepend_level" and all "keepend" items will work normally.
*/
- for (i = current_state.ga_len - 1; i > keepend_level; --i)
- if (CUR_STATE(i).si_flags & HL_EXTEND)
+ for (i = current_state.ga_len - 1; i > keepend_level; --i) {
+ if (CUR_STATE(i).si_flags & HL_EXTEND) {
break;
+ }
+ }
maxpos.lnum = 0;
maxpos.col = 0;
@@ -2438,13 +2511,15 @@ static void check_keepend(void)
if (maxpos.lnum == 0
|| maxpos.lnum > sip->si_m_endpos.lnum
|| (maxpos.lnum == sip->si_m_endpos.lnum
- && maxpos.col > sip->si_m_endpos.col))
+ && maxpos.col > sip->si_m_endpos.col)) {
maxpos = sip->si_m_endpos;
+ }
if (maxpos_h.lnum == 0
|| maxpos_h.lnum > sip->si_h_endpos.lnum
|| (maxpos_h.lnum == sip->si_h_endpos.lnum
- && maxpos_h.col > sip->si_h_endpos.col))
+ && maxpos_h.col > sip->si_h_endpos.col)) {
maxpos_h = sip->si_h_endpos;
+ }
}
}
}
@@ -2461,15 +2536,17 @@ static void update_si_end(stateitem_T *sip, int startcol, bool force)
lpos_T hl_endpos;
lpos_T end_endpos;
- /* return quickly for a keyword */
- if (sip->si_idx < 0)
+ // return quickly for a keyword
+ if (sip->si_idx < 0) {
return;
+ }
/* Don't update when it's already done. Can be a match of an end pattern
* that started in a previous line. Watch out: can also be a "keepend"
* from a containing item. */
- if (!force && sip->si_m_endpos.lnum >= current_lnum)
+ if (!force && sip->si_m_endpos.lnum >= current_lnum) {
return;
+ }
/*
* We need to find the end of the region. It may continue in the next
@@ -2482,23 +2559,23 @@ static void update_si_end(stateitem_T *sip, int startcol, bool force)
};
lpos_T endpos = { 0 };
find_endpos(sip->si_idx, &startpos, &endpos, &hl_endpos,
- &(sip->si_flags), &end_endpos, &end_idx, sip->si_extmatch);
+ &(sip->si_flags), &end_endpos, &end_idx, sip->si_extmatch);
if (endpos.lnum == 0) {
- /* No end pattern matched. */
+ // No end pattern matched.
if (SYN_ITEMS(syn_block)[sip->si_idx].sp_flags & HL_ONELINE) {
- /* a "oneline" never continues in the next line */
+ // a "oneline" never continues in the next line
sip->si_ends = TRUE;
sip->si_m_endpos.lnum = current_lnum;
sip->si_m_endpos.col = (colnr_T)STRLEN(syn_getcurline());
} else {
- /* continues in the next line */
+ // continues in the next line
sip->si_ends = FALSE;
sip->si_m_endpos.lnum = 0;
}
sip->si_h_endpos = sip->si_m_endpos;
} else {
- /* match within this line */
+ // match within this line
sip->si_m_endpos = endpos;
sip->si_h_endpos = hl_endpos;
sip->si_eoe_pos = end_endpos;
@@ -2527,49 +2604,49 @@ static void pop_current_state(void)
unref_extmatch(CUR_STATE(current_state.ga_len - 1).si_extmatch);
--current_state.ga_len;
}
- /* after the end of a pattern, try matching a keyword or pattern */
+ // after the end of a pattern, try matching a keyword or pattern
next_match_idx = -1;
- /* if first state with "keepend" is popped, reset keepend_level */
- if (keepend_level >= current_state.ga_len)
+ // if first state with "keepend" is popped, reset keepend_level
+ if (keepend_level >= current_state.ga_len) {
keepend_level = -1;
+ }
}
-/*
- * Find the end of a start/skip/end syntax region after "startpos".
- * Only checks one line.
- * Also handles a match item that continued from a previous line.
- * If not found, the syntax item continues in the next line. m_endpos->lnum
- * will be 0.
- * If found, the end of the region and the end of the highlighting is
- * computed.
- */
-static void
-find_endpos(
- int idx, // index of the pattern
- lpos_T *startpos, // where to start looking for an END match
- lpos_T *m_endpos, // return: end of match
- lpos_T *hl_endpos, // return: end of highlighting
- long *flagsp, // return: flags of matching END
- lpos_T *end_endpos, // return: end of end pattern match
- int *end_idx, // return: group ID for end pat. match, or 0
- reg_extmatch_T *start_ext // submatches from the start pattern
-)
+/// Find the end of a start/skip/end syntax region after "startpos".
+/// Only checks one line.
+/// Also handles a match item that continued from a previous line.
+/// If not found, the syntax item continues in the next line. m_endpos->lnum
+/// will be 0.
+/// If found, the end of the region and the end of the highlighting is
+/// computed.
+///
+/// @param idx index of the pattern
+/// @param startpos where to start looking for an END match
+/// @param m_endpos return: end of match
+/// @param hl_endpos return: end of highlighting
+/// @param flagsp return: flags of matching END
+/// @param end_endpos return: end of end pattern match
+/// @param end_idx return: group ID for end pat. match, or 0
+/// @param start_ext submatches from the start pattern
+static void find_endpos(int idx, lpos_T *startpos, lpos_T *m_endpos, lpos_T *hl_endpos,
+ long *flagsp, lpos_T *end_endpos, int *end_idx, reg_extmatch_T *start_ext)
{
colnr_T matchcol;
- synpat_T *spp, *spp_skip;
+ synpat_T *spp, *spp_skip;
int start_idx;
int best_idx;
regmmatch_T regmatch;
- regmmatch_T best_regmatch; /* startpos/endpos of best match */
+ regmmatch_T best_regmatch; // startpos/endpos of best match
lpos_T pos;
- char_u *line;
+ char_u *line;
bool had_match = false;
char_u buf_chartab[32]; // chartab array for syn option iskeyword
- /* just in case we are invoked for a keyword */
- if (idx < 0)
+ // just in case we are invoked for a keyword
+ if (idx < 0) {
return;
+ }
/*
* Check for being called with a START pattern.
@@ -2587,21 +2664,23 @@ find_endpos(
*/
for (;; ) {
spp = &(SYN_ITEMS(syn_block)[idx]);
- if (spp->sp_type != SPTYPE_START)
+ if (spp->sp_type != SPTYPE_START) {
break;
+ }
++idx;
}
/*
- * Lookup the SKIP pattern (if present)
+ * Lookup the SKIP pattern (if present)
*/
if (spp->sp_type == SPTYPE_SKIP) {
spp_skip = spp;
++idx;
- } else
+ } else {
spp_skip = NULL;
+ }
- /* Setup external matches for syn_regexec(). */
+ // Setup external matches for syn_regexec().
unref_extmatch(re_extmatch_in);
re_extmatch_in = ref_extmatch(start_ext);
@@ -2621,11 +2700,13 @@ find_endpos(
int lc_col = matchcol;
spp = &(SYN_ITEMS(syn_block)[idx]);
- if (spp->sp_type != SPTYPE_END) /* past last END pattern */
+ if (spp->sp_type != SPTYPE_END) { // past last END pattern
break;
+ }
lc_col -= spp->sp_offsets[SPO_LC_OFF];
- if (lc_col < 0)
+ if (lc_col < 0) {
lc_col = 0;
+ }
regmatch.rmm_ic = spp->sp_ic;
regmatch.regprog = spp->sp_prog;
@@ -2646,8 +2727,9 @@ find_endpos(
* If all end patterns have been tried, and there is no match, the
* item continues until end-of-line.
*/
- if (best_idx == -1)
+ if (best_idx == -1) {
break;
+ }
/*
* If the skip pattern matches before the end pattern,
@@ -2656,8 +2738,9 @@ find_endpos(
if (spp_skip != NULL) {
int lc_col = matchcol - spp_skip->sp_offsets[SPO_LC_OFF];
- if (lc_col < 0)
+ if (lc_col < 0) {
lc_col = 0;
+ }
regmatch.rmm_ic = spp_skip->sp_ic;
regmatch.regprog = spp_skip->sp_prog;
int r = syn_regexec(&regmatch, startpos->lnum, lc_col,
@@ -2704,16 +2787,18 @@ find_endpos(
*/
spp = &(SYN_ITEMS(syn_block)[best_idx]);
syn_add_end_off(m_endpos, &best_regmatch, spp, SPO_ME_OFF, 1);
- /* can't end before the start */
- if (m_endpos->lnum == startpos->lnum && m_endpos->col < startpos->col)
+ // can't end before the start
+ if (m_endpos->lnum == startpos->lnum && m_endpos->col < startpos->col) {
m_endpos->col = startpos->col;
+ }
syn_add_end_off(end_endpos, &best_regmatch, spp, SPO_HE_OFF, 1);
- /* can't end before the start */
+ // can't end before the start
if (end_endpos->lnum == startpos->lnum
- && end_endpos->col < startpos->col)
+ && end_endpos->col < startpos->col) {
end_endpos->col = startpos->col;
- /* can't end after the match */
+ }
+ // can't end after the match
limit_pos(end_endpos, m_endpos);
/*
@@ -2730,10 +2815,11 @@ find_endpos(
}
hl_endpos->col += spp->sp_offsets[SPO_RE_OFF];
- /* can't end before the start */
+ // can't end before the start
if (hl_endpos->lnum == startpos->lnum
- && hl_endpos->col < startpos->col)
+ && hl_endpos->col < startpos->col) {
hl_endpos->col = startpos->col;
+ }
limit_pos(hl_endpos, m_endpos);
/* now the match ends where the highlighting ends, it is turned
@@ -2750,13 +2836,14 @@ find_endpos(
break;
}
- /* no match for an END pattern in this line */
- if (!had_match)
+ // no match for an END pattern in this line
+ if (!had_match) {
m_endpos->lnum = 0;
+ }
restore_chartab(buf_chartab);
- /* Remove external matches. */
+ // Remove external matches.
unref_extmatch(re_extmatch_in);
re_extmatch_in = NULL;
}
@@ -2766,10 +2853,11 @@ find_endpos(
*/
static void limit_pos(lpos_T *pos, lpos_T *limit)
{
- if (pos->lnum > limit->lnum)
+ if (pos->lnum > limit->lnum) {
*pos = *limit;
- else if (pos->lnum == limit->lnum && pos->col > limit->col)
+ } else if (pos->lnum == limit->lnum && pos->col > limit->col) {
pos->col = limit->col;
+ }
}
/*
@@ -2777,28 +2865,27 @@ static void limit_pos(lpos_T *pos, lpos_T *limit)
*/
static void limit_pos_zero(lpos_T *pos, lpos_T *limit)
{
- if (pos->lnum == 0)
+ if (pos->lnum == 0) {
*pos = *limit;
- else
+ } else {
limit_pos(pos, limit);
+ }
}
-/*
- * Add offset to matched text for end of match or highlight.
- */
-static void
-syn_add_end_off(
- lpos_T *result, // returned position
- regmmatch_T *regmatch, // start/end of match
- synpat_T *spp, // matched pattern
- int idx, // index of offset
- int extra // extra chars for offset to start
-)
+/// Add offset to matched text for end of match or highlight.
+///
+/// @param result returned position
+/// @param regmatch start/end of match
+/// @param spp matched pattern
+/// @param idx index of offset
+/// @param extra extra chars for offset to start
+static void syn_add_end_off(lpos_T *result, regmmatch_T *regmatch, synpat_T *spp, int idx,
+ int extra)
{
int col;
int off;
- char_u *base;
- char_u *p;
+ char_u *base;
+ char_u *p;
if (spp->sp_off_flags & (1 << idx)) {
result->lnum = regmatch->startpos[0].lnum;
@@ -2830,23 +2917,19 @@ syn_add_end_off(
result->col = col;
}
-/*
- * Add offset to matched text for start of match or highlight.
- * Avoid resulting column to become negative.
- */
-static void
-syn_add_start_off(
- lpos_T *result, // returned position
- regmmatch_T *regmatch, // start/end of match
- synpat_T *spp,
- int idx,
- int extra // extra chars for offset to end
-)
+/// Add offset to matched text for start of match or highlight.
+/// Avoid resulting column to become negative.
+///
+/// @param result returned position
+/// @param regmatch start/end of match
+/// @param extra extra chars for offset to end
+static void syn_add_start_off(lpos_T *result, regmmatch_T *regmatch, synpat_T *spp, int idx,
+ int extra)
{
int col;
int off;
- char_u *base;
- char_u *p;
+ char_u *base;
+ char_u *p;
if (spp->sp_off_flags & (1 << (idx + SPO_COUNT))) {
result->lnum = regmatch->endpos[0].lnum;
@@ -2858,7 +2941,7 @@ syn_add_start_off(
off = spp->sp_offsets[idx];
}
if (result->lnum > syn_buf->b_ml.ml_line_count) {
- /* a "\n" at the end of the pattern may take us below the last line */
+ // a "\n" at the end of the pattern may take us below the last line
result->lnum = syn_buf->b_ml.ml_line_count;
col = (int)STRLEN(ml_get_buf(syn_buf, result->lnum, false));
}
@@ -2920,8 +3003,9 @@ static int syn_regexec(regmmatch_T *rmp, linenr_T lnum, colnr_T col, syn_time_T
st->slowest = pt;
}
++st->count;
- if (r > 0)
+ if (r > 0) {
++st->match;
+ }
}
if (timed_out && !syn_win->w_s->b_syn_slow) {
syn_win->w_s->b_syn_slow = true;
@@ -2936,20 +3020,19 @@ static int syn_regexec(regmmatch_T *rmp, linenr_T lnum, colnr_T col, syn_time_T
return FALSE;
}
-/*
- * Check one position in a line for a matching keyword.
- * The caller must check if a keyword can start at startcol.
- * Return its ID if found, 0 otherwise.
- */
-static int check_keyword_id(
- char_u *const line,
- const int startcol, // position in line to check for keyword
- int *const endcolp, // return: character after found keyword
- long *const flagsp, // return: flags of matching keyword
- int16_t **const next_listp, // return: next_list of matching keyword
- stateitem_T *const cur_si, // item at the top of the stack
- int *const ccharp // conceal substitution char
-)
+/// Check one position in a line for a matching keyword.
+/// The caller must check if a keyword can start at startcol.
+/// Return its ID if found, 0 otherwise.
+///
+/// @param startcol position in line to check for keyword
+/// @param endcolp return: character after found keyword
+/// @param flagsp return: flags of matching keyword
+/// @param next_listp return: next_list of matching keyword
+/// @param cur_si item at the top of the stack
+/// @param ccharp conceal substitution char
+static int check_keyword_id(char_u *const line, const int startcol, int *const endcolp,
+ long *const flagsp, int16_t **const next_listp,
+ stateitem_T *const cur_si, int *const ccharp)
{
// Find first character after the keyword. First character was already
// checked.
@@ -2997,11 +3080,10 @@ static int check_keyword_id(
/// When current_next_list is non-zero accept only that group, otherwise:
/// Accept a not-contained keyword at toplevel.
/// Accept a keyword at other levels only if it is in the contains list.
-static keyentry_T *match_keyword(char_u *keyword, hashtab_T *ht,
- stateitem_T *cur_si)
+static keyentry_T *match_keyword(char_u *keyword, hashtab_T *ht, stateitem_T *cur_si)
{
hashitem_T *hi = hash_find(ht, keyword);
- if (!HASHITEM_EMPTY(hi))
+ if (!HASHITEM_EMPTY(hi)) {
for (keyentry_T *kp = HI2KE(hi); kp != NULL; kp = kp->ke_next) {
if (current_next_list != 0
? in_id_list(NULL, current_next_list, &kp->k_syn, 0)
@@ -3012,6 +3094,7 @@ static keyentry_T *match_keyword(char_u *keyword, hashtab_T *ht,
return kp;
}
}
+ }
return NULL;
}
@@ -3020,12 +3103,13 @@ static keyentry_T *match_keyword(char_u *keyword, hashtab_T *ht,
*/
static void syn_cmd_conceal(exarg_T *eap, int syncing)
{
- char_u *arg = eap->arg;
- char_u *next;
+ char_u *arg = eap->arg;
+ char_u *next;
eap->nextcmd = find_nextcmd(arg);
- if (eap->skip)
+ if (eap->skip) {
return;
+ }
next = skiptowhite(arg);
if (*arg == NUL) {
@@ -3048,12 +3132,13 @@ static void syn_cmd_conceal(exarg_T *eap, int syncing)
*/
static void syn_cmd_case(exarg_T *eap, int syncing)
{
- char_u *arg = eap->arg;
- char_u *next;
+ char_u *arg = eap->arg;
+ char_u *next;
eap->nextcmd = find_nextcmd(arg);
- if (eap->skip)
+ if (eap->skip) {
return;
+ }
next = skiptowhite(arg);
if (*arg == NUL) {
@@ -3078,14 +3163,18 @@ static void syn_cmd_foldlevel(exarg_T *eap, int syncing)
char_u *arg_end;
eap->nextcmd = find_nextcmd(arg);
- if (eap->skip)
+ if (eap->skip) {
return;
+ }
if (*arg == NUL) {
switch (curwin->w_s->b_syn_foldlevel) {
- case SYNFLD_START: MSG(_("syntax foldlevel start")); break;
- case SYNFLD_MINIMUM: MSG(_("syntax foldlevel minimum")); break;
- default: break;
+ case SYNFLD_START:
+ MSG(_("syntax foldlevel start")); break;
+ case SYNFLD_MINIMUM:
+ MSG(_("syntax foldlevel minimum")); break;
+ default:
+ break;
}
return;
}
@@ -3111,12 +3200,13 @@ static void syn_cmd_foldlevel(exarg_T *eap, int syncing)
*/
static void syn_cmd_spell(exarg_T *eap, int syncing)
{
- char_u *arg = eap->arg;
- char_u *next;
+ char_u *arg = eap->arg;
+ char_u *next;
eap->nextcmd = find_nextcmd(arg);
- if (eap->skip)
+ if (eap->skip) {
return;
+ }
next = skiptowhite(arg);
if (*arg == NUL) {
@@ -3195,17 +3285,17 @@ void syntax_clear(synblock_T *block)
block->b_syn_containedin = false;
block->b_syn_conceal = false;
- /* free the keywords */
+ // free the keywords
clear_keywtab(&block->b_keywtab);
clear_keywtab(&block->b_keywtab_ic);
- /* free the syntax patterns */
+ // free the syntax patterns
for (int i = block->b_syn_patterns.ga_len; --i >= 0; ) {
syn_clear_pattern(block, i);
}
ga_clear(&block->b_syn_patterns);
- /* free the syntax clusters */
+ // free the syntax clusters
for (int i = block->b_syn_clusters.ga_len; --i >= 0; ) {
syn_clear_cluster(block, i);
}
@@ -3224,11 +3314,11 @@ void syntax_clear(synblock_T *block)
block->b_syn_folditems = 0;
clear_string_option(&block->b_syn_isk);
- /* free the stored states */
+ // free the stored states
syn_stack_free_all(block);
invalidate_current_state();
- /* Reset the counter for ":syn include" */
+ // Reset the counter for ":syn include"
running_syn_inc_tag = 0;
}
@@ -3249,7 +3339,7 @@ void reset_synblock(win_T *wp)
*/
static void syntax_sync_clear(void)
{
- /* free the syntax patterns */
+ // free the syntax patterns
for (int i = curwin->w_s->b_syn_patterns.ga_len; --i >= 0; ) {
if (SYN_ITEMS(curwin->w_s)[i].sp_syncing) {
syn_remove_pattern(curwin->w_s, i);
@@ -3266,7 +3356,7 @@ static void syntax_sync_clear(void)
XFREE_CLEAR(curwin->w_s->b_syn_linecont_pat);
clear_string_option(&curwin->w_s->b_syn_isk);
- syn_stack_free_all(curwin->w_s); /* Need to recompute all syntax. */
+ syn_stack_free_all(curwin->w_s); // Need to recompute all syntax.
}
/*
@@ -3274,14 +3364,15 @@ static void syntax_sync_clear(void)
*/
static void syn_remove_pattern(synblock_T *block, int idx)
{
- synpat_T *spp;
+ synpat_T *spp;
spp = &(SYN_ITEMS(block)[idx]);
- if (spp->sp_flags & HL_FOLD)
+ if (spp->sp_flags & HL_FOLD) {
--block->b_syn_folditems;
+ }
syn_clear_pattern(block, idx);
memmove(spp, spp + 1,
- sizeof(synpat_T) * (block->b_syn_patterns.ga_len - idx - 1));
+ sizeof(synpat_T) * (block->b_syn_patterns.ga_len - idx - 1));
--block->b_syn_patterns.ga_len;
}
@@ -3293,7 +3384,7 @@ static void syn_clear_pattern(synblock_T *block, int i)
{
xfree(SYN_ITEMS(block)[i].sp_pattern);
vim_regfree(SYN_ITEMS(block)[i].sp_prog);
- /* Only free sp_cont_list and sp_next_list of first start pattern */
+ // Only free sp_cont_list and sp_next_list of first start pattern
if (i == 0 || SYN_ITEMS(block)[i - 1].sp_type != SPTYPE_START) {
xfree(SYN_ITEMS(block)[i].sp_cont_list);
xfree(SYN_ITEMS(block)[i].sp_next_list);
@@ -3316,13 +3407,14 @@ static void syn_clear_cluster(synblock_T *block, int i)
*/
static void syn_cmd_clear(exarg_T *eap, int syncing)
{
- char_u *arg = eap->arg;
- char_u *arg_end;
+ char_u *arg = eap->arg;
+ char_u *arg_end;
int id;
eap->nextcmd = find_nextcmd(arg);
- if (eap->skip)
+ if (eap->skip) {
return;
+ }
/*
* We have to disable this within ":syn include @group filename",
@@ -3330,16 +3422,17 @@ static void syn_cmd_clear(exarg_T *eap, int syncing)
* Only required for Vim 5.x syntax files, 6.0 ones don't contain ":syn
* clear".
*/
- if (curwin->w_s->b_syn_topgrp != 0)
+ if (curwin->w_s->b_syn_topgrp != 0) {
return;
+ }
if (ends_excmd(*arg)) {
/*
* No argument: Clear all syntax items.
*/
- if (syncing)
+ if (syncing) {
syntax_sync_clear();
- else {
+ } else {
syntax_clear(curwin->w_s);
if (curwin->w_s == &curwin->w_buffer->b_s) {
do_unlet(S_LEN("b:current_syntax"), true);
@@ -3370,14 +3463,15 @@ static void syn_cmd_clear(exarg_T *eap, int syncing)
if (id == 0) {
EMSG2(_(e_nogroup), arg);
break;
- } else
+ } else {
syn_clear_one(id, syncing);
+ }
}
arg = skipwhite(arg_end);
}
}
redraw_curbuf_later(SOME_VALID);
- syn_stack_free_all(curwin->w_s); /* Need to recompute all syntax. */
+ syn_stack_free_all(curwin->w_s); // Need to recompute all syntax.
}
/*
@@ -3385,19 +3479,20 @@ static void syn_cmd_clear(exarg_T *eap, int syncing)
*/
static void syn_clear_one(const int id, const bool syncing)
{
- synpat_T *spp;
+ synpat_T *spp;
- /* Clear keywords only when not ":syn sync clear group-name" */
+ // Clear keywords only when not ":syn sync clear group-name"
if (!syncing) {
syn_clear_keyword(id, &curwin->w_s->b_keywtab);
syn_clear_keyword(id, &curwin->w_s->b_keywtab_ic);
}
- /* clear the patterns for "id" */
+ // clear the patterns for "id"
for (int idx = curwin->w_s->b_syn_patterns.ga_len; --idx >= 0; ) {
spp = &(SYN_ITEMS(curwin->w_s)[idx]);
- if (spp->sp_syn.id != id || spp->sp_syncing != syncing)
+ if (spp->sp_syn.id != id || spp->sp_syncing != syncing) {
continue;
+ }
syn_remove_pattern(curwin->w_s, idx);
}
}
@@ -3461,21 +3556,18 @@ void syn_maybe_enable(void)
}
}
-/*
- * Handle ":syntax [list]" command: list current syntax words.
- */
-static void
-syn_cmd_list(
- exarg_T *eap,
- int syncing /* when TRUE: list syncing items */
-)
+/// Handle ":syntax [list]" command: list current syntax words.
+///
+/// @param syncing when TRUE: list syncing items
+static void syn_cmd_list(exarg_T *eap, int syncing)
{
- char_u *arg = eap->arg;
- char_u *arg_end;
+ char_u *arg = eap->arg;
+ char_u *arg_end;
eap->nextcmd = find_nextcmd(arg);
- if (eap->skip)
+ if (eap->skip) {
return;
+ }
if (!syntax_present(curwin)) {
MSG(_(msg_no_items));
@@ -3488,7 +3580,7 @@ syn_cmd_list(
syn_lines_msg();
syn_match_msg();
return;
- } else if (!(curwin->w_s->b_syn_sync_flags & SF_MATCH)) {
+ } else if (!(curwin->w_s->b_syn_sync_flags & SF_MATCH)) {
if (curwin->w_s->b_syn_sync_minlines == 0) {
MSG_PUTS(_("no syncing"));
} else {
@@ -3511,8 +3603,9 @@ syn_cmd_list(
syn_lines_msg();
syn_match_msg();
}
- } else
+ } else {
MSG_PUTS_TITLE(_("\n--- Syntax items ---"));
+ }
if (ends_excmd(*arg)) {
/*
* No argument: List all group IDs and all syntax clusters.
@@ -3531,10 +3624,11 @@ syn_cmd_list(
arg_end = skiptowhite(arg);
if (*arg == '@') {
int id = syn_scl_namen2id(arg + 1, (int)(arg_end - arg - 1));
- if (id == 0)
+ if (id == 0) {
EMSG2(_("E392: No such syntax cluster: %s"), arg);
- else
+ } else {
syn_list_cluster(id - SYNID_CLUSTER);
+ }
} else {
int id = syn_name2id_len(arg, (int)(arg_end - arg));
if (id == 0) {
@@ -3585,37 +3679,33 @@ static void syn_match_msg(void)
static int last_matchgroup;
-/*
- * List one syntax item, for ":syntax" or "syntax list syntax_name".
- */
-static void
-syn_list_one(
- const int id,
- const bool syncing, // when true: list syncing items
- const bool link_only // when true; list link-only too
-)
+/// List one syntax item, for ":syntax" or "syntax list syntax_name".
+///
+/// @param syncing when true: list syncing items
+/// @param link_only when true; list link-only too
+static void syn_list_one(const int id, const bool syncing, const bool link_only)
{
bool did_header = false;
static struct name_list namelist1[] =
{
- {HL_DISPLAY, "display"},
- {HL_CONTAINED, "contained"},
- {HL_ONELINE, "oneline"},
- {HL_KEEPEND, "keepend"},
- {HL_EXTEND, "extend"},
- {HL_EXCLUDENL, "excludenl"},
- {HL_TRANSP, "transparent"},
- {HL_FOLD, "fold"},
- {HL_CONCEAL, "conceal"},
- {HL_CONCEALENDS, "concealends"},
- {0, NULL}
+ { HL_DISPLAY, "display" },
+ { HL_CONTAINED, "contained" },
+ { HL_ONELINE, "oneline" },
+ { HL_KEEPEND, "keepend" },
+ { HL_EXTEND, "extend" },
+ { HL_EXCLUDENL, "excludenl" },
+ { HL_TRANSP, "transparent" },
+ { HL_FOLD, "fold" },
+ { HL_CONCEAL, "conceal" },
+ { HL_CONCEALENDS, "concealends" },
+ { 0, NULL }
};
static struct name_list namelist2[] =
{
- {HL_SKIPWHITE, "skipwhite"},
- {HL_SKIPNL, "skipnl"},
- {HL_SKIPEMPTY, "skipempty"},
- {0, NULL}
+ { HL_SKIPWHITE, "skipwhite" },
+ { HL_SKIPNL, "skipnl" },
+ { HL_SKIPEMPTY, "skipempty" },
+ { 0, NULL }
};
const int attr = HL_ATTR(HLF_D); // highlight like directories
@@ -3642,14 +3732,17 @@ syn_list_one(
if (spp->sp_type == SPTYPE_MATCH) {
put_pattern("match", ' ', spp, attr);
msg_putchar(' ');
- } else if (spp->sp_type == SPTYPE_START) {
- while (SYN_ITEMS(curwin->w_s)[idx].sp_type == SPTYPE_START)
+ } else if (spp->sp_type == SPTYPE_START) {
+ while (SYN_ITEMS(curwin->w_s)[idx].sp_type == SPTYPE_START) {
put_pattern("start", '=', &SYN_ITEMS(curwin->w_s)[idx++], attr);
- if (SYN_ITEMS(curwin->w_s)[idx].sp_type == SPTYPE_SKIP)
+ }
+ if (SYN_ITEMS(curwin->w_s)[idx].sp_type == SPTYPE_SKIP) {
put_pattern("skip", '=', &SYN_ITEMS(curwin->w_s)[idx++], attr);
+ }
while (idx < curwin->w_s->b_syn_patterns.ga_len
- && SYN_ITEMS(curwin->w_s)[idx].sp_type == SPTYPE_END)
+ && SYN_ITEMS(curwin->w_s)[idx].sp_type == SPTYPE_END) {
put_pattern("end", '=', &SYN_ITEMS(curwin->w_s)[idx++], attr);
+ }
--idx;
msg_putchar(' ');
}
@@ -3674,16 +3767,17 @@ syn_list_one(
msg_puts_attr("groupthere", attr);
}
msg_putchar(' ');
- if (spp->sp_sync_idx >= 0)
+ if (spp->sp_sync_idx >= 0) {
msg_outtrans(HL_TABLE()[SYN_ITEMS(curwin->w_s)
[spp->sp_sync_idx].sp_syn.id - 1].sg_name);
- else
+ } else {
MSG_PUTS("NONE");
+ }
msg_putchar(' ');
}
}
- /* list the link, if there is one */
+ // list the link, if there is one
if (HL_TABLE()[id - 1].sg_link && (did_header || link_only) && !got_int) {
(void)syn_list_header(did_header, 0, id, true);
msg_puts_attr("links to", attr);
@@ -3696,11 +3790,12 @@ static void syn_list_flags(struct name_list *nlist, int flags, int attr)
{
int i;
- for (i = 0; nlist[i].flag != 0; ++i)
+ for (i = 0; nlist[i].flag != 0; ++i) {
if (flags & nlist[i].flag) {
msg_puts_attr(nlist[i].name, attr);
msg_putchar(' ');
}
+ }
}
/*
@@ -3710,14 +3805,16 @@ static void syn_list_cluster(int id)
{
int endcol = 15;
- /* slight hack: roughly duplicate the guts of syn_list_header() */
+ // slight hack: roughly duplicate the guts of syn_list_header()
msg_putchar('\n');
msg_outtrans(SYN_CLSTR(curwin->w_s)[id].scl_name);
- if (msg_col >= endcol) /* output at least one space */
+ if (msg_col >= endcol) { // output at least one space
endcol = msg_col + 1;
- if (Columns <= endcol) /* avoid hang for tiny window */
+ }
+ if (Columns <= endcol) { // avoid hang for tiny window
endcol = Columns - 1;
+ }
msg_advance(endcol);
if (SYN_CLSTR(curwin->w_s)[id].scl_list != NULL) {
@@ -3728,9 +3825,7 @@ static void syn_list_cluster(int id)
}
}
-static void put_id_list(const char *const name,
- const int16_t *const list,
- const int attr)
+static void put_id_list(const char *const name, const int16_t *const list, const int attr)
{
msg_puts_attr(name, attr);
msg_putchar('=');
@@ -3741,38 +3836,40 @@ static void put_id_list(const char *const name,
} else {
msg_puts("ALL");
}
- } else if (*p >= SYNID_TOP && *p < SYNID_CONTAINED) {
+ } else if (*p >= SYNID_TOP && *p < SYNID_CONTAINED) {
msg_puts("TOP");
- } else if (*p >= SYNID_CONTAINED && *p < SYNID_CLUSTER) {
+ } else if (*p >= SYNID_CONTAINED && *p < SYNID_CLUSTER) {
msg_puts("CONTAINED");
- } else if (*p >= SYNID_CLUSTER) {
+ } else if (*p >= SYNID_CLUSTER) {
int scl_id = *p - SYNID_CLUSTER;
msg_putchar('@');
msg_outtrans(SYN_CLSTR(curwin->w_s)[scl_id].scl_name);
- } else
+ } else {
msg_outtrans(HL_TABLE()[*p - 1].sg_name);
- if (p[1])
+ }
+ if (p[1]) {
msg_putchar(',');
+ }
}
msg_putchar(' ');
}
-static void put_pattern(const char *const s, const int c,
- const synpat_T *const spp, const int attr)
+static void put_pattern(const char *const s, const int c, const synpat_T *const spp, const int attr)
{
static const char *const sepchars = "/+=-#@\"|'^&";
int i;
- /* May have to write "matchgroup=group" */
+ // May have to write "matchgroup=group"
if (last_matchgroup != spp->sp_syn_match_id) {
last_matchgroup = spp->sp_syn_match_id;
msg_puts_attr("matchgroup", attr);
msg_putchar('=');
- if (last_matchgroup == 0)
+ if (last_matchgroup == 0) {
msg_outtrans((char_u *)"NONE");
- else
+ } else {
msg_outtrans(HL_TABLE()[last_matchgroup - 1].sg_name);
+ }
msg_putchar(' ');
}
@@ -3780,12 +3877,13 @@ static void put_pattern(const char *const s, const int c,
msg_puts_attr(s, attr);
msg_putchar(c);
- /* output the pattern, in between a char that is not in the pattern */
- for (i = 0; vim_strchr(spp->sp_pattern, sepchars[i]) != NULL; )
+ // output the pattern, in between a char that is not in the pattern
+ for (i = 0; vim_strchr(spp->sp_pattern, sepchars[i]) != NULL; ) {
if (sepchars[++i] == NUL) {
- i = 0; /* no good char found, just use the first one */
+ i = 0; // no good char found, just use the first one
break;
}
+ }
msg_putchar(sepchars[i]);
msg_outtrans(spp->sp_pattern);
msg_putchar(sepchars[i]);
@@ -3803,12 +3901,14 @@ static void put_pattern(const char *const s, const int c,
msg_puts(spo_name_tab[i]);
const long n = spp->sp_offsets[i];
if (i != SPO_LC_OFF) {
- if (spp->sp_off_flags & mask)
+ if (spp->sp_off_flags & mask) {
msg_putchar('s');
- else
+ } else {
msg_putchar('e');
- if (n > 0)
+ }
+ if (n > 0) {
msg_putchar('+');
+ }
}
if (n || i == SPO_LC_OFF) {
msg_outnum(n);
@@ -3818,14 +3918,13 @@ static void put_pattern(const char *const s, const int c,
msg_putchar(' ');
}
-// List or clear the keywords for one syntax group.
-// Return true if the header has been printed.
-static bool syn_list_keywords(
- const int id,
- const hashtab_T *const ht,
- bool did_header, // header has already been printed
- const int attr
-)
+/// List or clear the keywords for one syntax group.
+///
+/// @param did_header header has already been printed
+///
+/// @return true if the header has been printed.
+static bool syn_list_keywords(const int id, const hashtab_T *const ht, bool did_header,
+ const int attr)
{
int prev_contained = 0;
const int16_t *prev_next_list = NULL;
@@ -3852,7 +3951,7 @@ static bool syn_list_keywords(
|| prev_skipempty != (kp->flags & HL_SKIPEMPTY)
|| prev_cont_in_list != kp->k_syn.cont_in_list
|| prev_next_list != kp->next_list) {
- force_newline = true;
+ force_newline = true;
} else {
outlen = (int)STRLEN(kp->keyword);
}
@@ -3906,10 +4005,10 @@ static bool syn_list_keywords(
static void syn_clear_keyword(int id, hashtab_T *ht)
{
- hashitem_T *hi;
- keyentry_T *kp;
- keyentry_T *kp_prev;
- keyentry_T *kp_next;
+ hashitem_T *hi;
+ keyentry_T *kp;
+ keyentry_T *kp_prev;
+ keyentry_T *kp_next;
int todo;
hash_lock(ht);
@@ -3924,12 +4023,14 @@ static void syn_clear_keyword(int id, hashtab_T *ht)
if (kp->k_syn.id == id) {
kp_next = kp->ke_next;
if (kp_prev == NULL) {
- if (kp_next == NULL)
+ if (kp_next == NULL) {
hash_remove(ht, hi);
- else
+ } else {
hi->hi_key = KE2HIKEY(kp_next);
- } else
+ }
+ } else {
kp_prev->ke_next = kp_next;
+ }
xfree(kp->next_list);
xfree(kp->k_syn.cont_in_list);
xfree(kp);
@@ -3948,10 +4049,10 @@ static void syn_clear_keyword(int id, hashtab_T *ht)
*/
static void clear_keywtab(hashtab_T *ht)
{
- hashitem_T *hi;
+ hashitem_T *hi;
int todo;
- keyentry_T *kp;
- keyentry_T *kp_next;
+ keyentry_T *kp;
+ keyentry_T *kp_next;
todo = (int)ht->ht_used;
for (hi = ht->ht_array; todo > 0; ++hi) {
@@ -3976,11 +4077,8 @@ static void clear_keywtab(hashtab_T *ht)
/// @param flags flags for this keyword
/// @param cont_in_list containedin for this keyword
/// @param next_list nextgroup for this keyword
-static void add_keyword(char_u *const name,
- const int id,
- const int flags,
- int16_t *const cont_in_list,
- int16_t *const next_list,
+static void add_keyword(char_u *const name, const int id, const int flags,
+ int16_t *const cont_in_list, int16_t *const next_list,
const int conceal_char)
{
char_u name_folded[MAXKEYWLEN + 1];
@@ -4022,18 +4120,16 @@ static void add_keyword(char_u *const name,
}
}
-/*
- * Get the start and end of the group name argument.
- * Return a pointer to the first argument.
- * Return NULL if the end of the command was found instead of further args.
- */
-static char_u *
-get_group_name (
- char_u *arg, /* start of the argument */
- char_u **name_end /* pointer to end of the name */
-)
+/// Get the start and end of the group name argument.
+///
+/// @param arg start of the argument
+/// @param name_end pointer to end of the name
+///
+/// @return a pointer to the first argument.
+/// Return NULL if the end of the command was found instead of further args.
+static char_u *get_group_name(char_u *arg, char_u **name_end)
{
- char_u *rest;
+ char_u *rest;
*name_end = skiptowhite(arg);
rest = skipwhite(*name_end);
@@ -4042,62 +4138,62 @@ get_group_name (
* Check if there are enough arguments. The first argument may be a
* pattern, where '|' is allowed, so only check for NUL.
*/
- if (ends_excmd(*arg) || *rest == NUL)
+ if (ends_excmd(*arg) || *rest == NUL) {
return NULL;
+ }
return rest;
}
-/*
- * Check for syntax command option arguments.
- * This can be called at any place in the list of arguments, and just picks
- * out the arguments that are known. Can be called several times in a row to
- * collect all options in between other arguments.
- * Return a pointer to the next argument (which isn't an option).
- * Return NULL for any error;
- */
-static char_u *
-get_syn_options(
- char_u *arg, // next argument to be checked
- syn_opt_arg_T *opt, // various things
- int *conceal_char,
- int skip // TRUE if skipping over command
-)
-{
- char_u *gname_start, *gname;
+/// Check for syntax command option arguments.
+/// This can be called at any place in the list of arguments, and just picks
+/// out the arguments that are known. Can be called several times in a row to
+/// collect all options in between other arguments.
+///
+/// @param arg next argument to be checked
+/// @param opt various things
+/// @param skip TRUE if skipping over command
+///
+/// @return a pointer to the next argument (which isn't an option).
+/// Return NULL for any error;
+static char_u *get_syn_options(char_u *arg, syn_opt_arg_T *opt, int *conceal_char, int skip)
+{
+ char_u *gname_start, *gname;
int syn_id;
int len = 0;
- char *p;
+ char *p;
int fidx;
static const struct flag {
- char *name;
+ char *name;
int argtype;
int flags;
- } flagtab[] = { {"cCoOnNtTaAiInNeEdD", 0, HL_CONTAINED},
- {"oOnNeElLiInNeE", 0, HL_ONELINE},
- {"kKeEeEpPeEnNdD", 0, HL_KEEPEND},
- {"eExXtTeEnNdD", 0, HL_EXTEND},
- {"eExXcClLuUdDeEnNlL", 0, HL_EXCLUDENL},
- {"tTrRaAnNsSpPaArReEnNtT", 0, HL_TRANSP},
- {"sSkKiIpPnNlL", 0, HL_SKIPNL},
- {"sSkKiIpPwWhHiItTeE", 0, HL_SKIPWHITE},
- {"sSkKiIpPeEmMpPtTyY", 0, HL_SKIPEMPTY},
- {"gGrRoOuUpPhHeErReE", 0, HL_SYNC_HERE},
- {"gGrRoOuUpPtThHeErReE", 0, HL_SYNC_THERE},
- {"dDiIsSpPlLaAyY", 0, HL_DISPLAY},
- {"fFoOlLdD", 0, HL_FOLD},
- {"cCoOnNcCeEaAlL", 0, HL_CONCEAL},
- {"cCoOnNcCeEaAlLeEnNdDsS", 0, HL_CONCEALENDS},
- {"cCcChHaArR", 11, 0},
- {"cCoOnNtTaAiInNsS", 1, 0},
- {"cCoOnNtTaAiInNeEdDiInN", 2, 0},
- {"nNeExXtTgGrRoOuUpP", 3, 0},};
+ } flagtab[] = { { "cCoOnNtTaAiInNeEdD", 0, HL_CONTAINED },
+ { "oOnNeElLiInNeE", 0, HL_ONELINE },
+ { "kKeEeEpPeEnNdD", 0, HL_KEEPEND },
+ { "eExXtTeEnNdD", 0, HL_EXTEND },
+ { "eExXcClLuUdDeEnNlL", 0, HL_EXCLUDENL },
+ { "tTrRaAnNsSpPaArReEnNtT", 0, HL_TRANSP },
+ { "sSkKiIpPnNlL", 0, HL_SKIPNL },
+ { "sSkKiIpPwWhHiItTeE", 0, HL_SKIPWHITE },
+ { "sSkKiIpPeEmMpPtTyY", 0, HL_SKIPEMPTY },
+ { "gGrRoOuUpPhHeErReE", 0, HL_SYNC_HERE },
+ { "gGrRoOuUpPtThHeErReE", 0, HL_SYNC_THERE },
+ { "dDiIsSpPlLaAyY", 0, HL_DISPLAY },
+ { "fFoOlLdD", 0, HL_FOLD },
+ { "cCoOnNcCeEaAlL", 0, HL_CONCEAL },
+ { "cCoOnNcCeEaAlLeEnNdDsS", 0, HL_CONCEALENDS },
+ { "cCcChHaArR", 11, 0 },
+ { "cCoOnNtTaAiInNsS", 1, 0 },
+ { "cCoOnNtTaAiInNeEdDiInN", 2, 0 },
+ { "nNeExXtTgGrRoOuUpP", 3, 0 }, };
static const char *const first_letters = "cCoOkKeEtTsSgGdDfFnN";
- if (arg == NULL) /* already detected error */
+ if (arg == NULL) { // already detected error
return NULL;
+ }
- if (curwin->w_s->b_syn_conceal)
+ if (curwin->w_s->b_syn_conceal) {
opt->flags |= HL_CONCEAL;
+ }
for (;; ) {
/*
@@ -4105,15 +4201,17 @@ get_syn_options(
* Need to skip quickly when no option name is found.
* Also avoid tolower(), it's slow.
*/
- if (strchr(first_letters, *arg) == NULL)
+ if (strchr(first_letters, *arg) == NULL) {
break;
+ }
for (fidx = ARRAY_SIZE(flagtab); --fidx >= 0; ) {
p = flagtab[fidx].name;
int i;
for (i = 0, len = 0; p[i] != NUL; i += 2, ++len) {
- if (arg[len] != p[i] && arg[len] != p[i + 1])
+ if (arg[len] != p[i] && arg[len] != p[i + 1]) {
break;
+ }
}
if (p[i] == NUL && (ascii_iswhite(arg[len])
|| (flagtab[fidx].argtype > 0
@@ -4122,14 +4220,16 @@ get_syn_options(
if (opt->keyword
&& (flagtab[fidx].flags == HL_DISPLAY
|| flagtab[fidx].flags == HL_FOLD
- || flagtab[fidx].flags == HL_EXTEND))
- /* treat "display", "fold" and "extend" as a keyword */
+ || flagtab[fidx].flags == HL_EXTEND)) {
+ // treat "display", "fold" and "extend" as a keyword
fidx = -1;
+ }
break;
}
}
- if (fidx < 0) /* no match found */
+ if (fidx < 0) { // no match found
break;
+ }
if (flagtab[fidx].argtype == 1) {
if (!opt->has_cont_list) {
@@ -4139,15 +4239,15 @@ get_syn_options(
if (get_id_list(&arg, 8, &opt->cont_list, skip) == FAIL) {
return NULL;
}
- } else if (flagtab[fidx].argtype == 2) {
+ } else if (flagtab[fidx].argtype == 2) {
if (get_id_list(&arg, 11, &opt->cont_in_list, skip) == FAIL) {
return NULL;
}
- } else if (flagtab[fidx].argtype == 3) {
+ } else if (flagtab[fidx].argtype == 3) {
if (get_id_list(&arg, 9, &opt->next_list, skip) == FAIL) {
return NULL;
}
- } else if (flagtab[fidx].argtype == 11 && arg[5] == '=') {
+ } else if (flagtab[fidx].argtype == 11 && arg[5] == '=') {
// cchar=?
*conceal_char = utf_ptr2char(arg + 6);
arg += mb_ptr2len(arg + 6) - 1;
@@ -4168,20 +4268,22 @@ get_syn_options(
}
gname_start = arg;
arg = skiptowhite(arg);
- if (gname_start == arg)
+ if (gname_start == arg) {
return NULL;
+ }
gname = vim_strnsave(gname_start, arg - gname_start);
if (STRCMP(gname, "NONE") == 0) {
*opt->sync_idx = NONE_IDX;
} else {
syn_id = syn_name2id(gname);
int i;
- for (i = curwin->w_s->b_syn_patterns.ga_len; --i >= 0; )
+ for (i = curwin->w_s->b_syn_patterns.ga_len; --i >= 0; ) {
if (SYN_ITEMS(curwin->w_s)[i].sp_syn.id == syn_id
&& SYN_ITEMS(curwin->w_s)[i].sp_type == SPTYPE_START) {
*opt->sync_idx = i;
break;
}
+ }
if (i < 0) {
EMSG2(_("E394: Didn't find region item for %s"), gname);
xfree(gname);
@@ -4192,9 +4294,10 @@ get_syn_options(
xfree(gname);
arg = skipwhite(arg);
} else if (flagtab[fidx].flags == HL_FOLD
- && foldmethodIsSyntax(curwin))
- /* Need to update folds later. */
+ && foldmethodIsSyntax(curwin)) {
+ // Need to update folds later.
foldUpdateAll(curwin);
+ }
}
}
@@ -4208,8 +4311,9 @@ get_syn_options(
*/
static void syn_incl_toplevel(int id, int *flagsp)
{
- if ((*flagsp & HL_CONTAINED) || curwin->w_s->b_syn_topgrp == 0)
+ if ((*flagsp & HL_CONTAINED) || curwin->w_s->b_syn_topgrp == 0) {
return;
+ }
*flagsp |= HL_CONTAINED;
if (curwin->w_s->b_syn_topgrp >= SYNID_CLUSTER) {
// We have to alloc this, because syn_combine_list() will free it.
@@ -4219,7 +4323,7 @@ static void syn_incl_toplevel(int id, int *flagsp)
grp_list[0] = id;
grp_list[1] = 0;
syn_combine_list(&SYN_CLSTR(curwin->w_s)[tlg_id].scl_list, &grp_list,
- CLUSTER_ADD);
+ CLUSTER_ADD);
}
}
@@ -4228,18 +4332,19 @@ static void syn_incl_toplevel(int id, int *flagsp)
*/
static void syn_cmd_include(exarg_T *eap, int syncing)
{
- char_u *arg = eap->arg;
+ char_u *arg = eap->arg;
int sgl_id = 1;
- char_u *group_name_end;
- char_u *rest;
- char_u *errormsg = NULL;
+ char_u *group_name_end;
+ char_u *rest;
+ char_u *errormsg = NULL;
int prev_toplvl_grp;
int prev_syn_inc_tag;
bool source = false;
eap->nextcmd = find_nextcmd(arg);
- if (eap->skip)
+ if (eap->skip) {
return;
+ }
if (arg[0] == '@') {
++arg;
@@ -4249,9 +4354,10 @@ static void syn_cmd_include(exarg_T *eap, int syncing)
return;
}
sgl_id = syn_check_cluster(arg, (int)(group_name_end - arg));
- if (sgl_id == 0)
+ if (sgl_id == 0) {
return;
- /* separate_nextcmd() and expand_filename() depend on this */
+ }
+ // separate_nextcmd() and expand_filename() depend on this
eap->arg = rest;
}
@@ -4267,8 +4373,9 @@ static void syn_cmd_include(exarg_T *eap, int syncing)
// ":runtime!" is used.
source = true;
if (expand_filename(eap, syn_cmdlinep, &errormsg) == FAIL) {
- if (errormsg != NULL)
+ if (errormsg != NULL) {
EMSG(errormsg);
+ }
return;
}
}
@@ -4299,13 +4406,13 @@ static void syn_cmd_include(exarg_T *eap, int syncing)
*/
static void syn_cmd_keyword(exarg_T *eap, int syncing)
{
- char_u *arg = eap->arg;
- char_u *group_name_end;
+ char_u *arg = eap->arg;
+ char_u *group_name_end;
int syn_id;
- char_u *rest;
- char_u *keyword_copy = NULL;
- char_u *p;
- char_u *kw;
+ char_u *rest;
+ char_u *keyword_copy = NULL;
+ char_u *p;
+ char_u *kw;
syn_opt_arg_T syn_opt_arg;
int cnt;
int conceal_char = NUL;
@@ -4395,39 +4502,36 @@ error:
}
}
- if (rest != NULL)
+ if (rest != NULL) {
eap->nextcmd = check_nextcmd(rest);
- else
+ } else {
EMSG2(_(e_invarg2), arg);
+ }
redraw_curbuf_later(SOME_VALID);
- syn_stack_free_all(curwin->w_s); /* Need to recompute all syntax. */
+ syn_stack_free_all(curwin->w_s); // Need to recompute all syntax.
}
-/*
- * Handle ":syntax match {name} [{options}] {pattern} [{options}]".
- *
- * Also ":syntax sync match {name} [[grouphere | groupthere] {group-name}] .."
- */
-static void
-syn_cmd_match(
- exarg_T *eap,
- int syncing /* TRUE for ":syntax sync match .. " */
-)
-{
- char_u *arg = eap->arg;
- char_u *group_name_end;
- char_u *rest;
- synpat_T item; /* the item found in the line */
+/// Handle ":syntax match {name} [{options}] {pattern} [{options}]".
+///
+/// Also ":syntax sync match {name} [[grouphere | groupthere] {group-name}] .."
+///
+/// @param syncing TRUE for ":syntax sync match .. "
+static void syn_cmd_match(exarg_T *eap, int syncing)
+{
+ char_u *arg = eap->arg;
+ char_u *group_name_end;
+ char_u *rest;
+ synpat_T item; // the item found in the line
int syn_id;
syn_opt_arg_T syn_opt_arg;
int sync_idx = 0;
int conceal_char = NUL;
- /* Isolate the group name, check for validity */
+ // Isolate the group name, check for validity
rest = get_group_name(arg, &group_name_end);
- /* Get options before the pattern */
+ // Get options before the pattern
syn_opt_arg.flags = 0;
syn_opt_arg.keyword = false;
syn_opt_arg.sync_idx = syncing ? &sync_idx : NULL;
@@ -4437,7 +4541,7 @@ syn_cmd_match(
syn_opt_arg.next_list = NULL;
rest = get_syn_options(rest, &syn_opt_arg, &conceal_char, eap->skip);
- /* get the pattern. */
+ // get the pattern.
init_syn_patterns();
memset(&item, 0, sizeof(item));
rest = get_syn_pattern(rest, &item);
@@ -4448,14 +4552,14 @@ syn_cmd_match(
// Get options after the pattern
rest = get_syn_options(rest, &syn_opt_arg, &conceal_char, eap->skip);
- if (rest != NULL) { /* all arguments are valid */
+ if (rest != NULL) { // all arguments are valid
/*
* Check for trailing command and illegal trailing arguments.
*/
eap->nextcmd = check_nextcmd(rest);
- if (!ends_excmd(*rest) || eap->skip)
+ if (!ends_excmd(*rest) || eap->skip) {
rest = NULL;
- else {
+ } else {
if ((syn_id = syn_check_group(arg, (int)(group_name_end - arg))) != 0) {
syn_incl_toplevel(syn_id, &syn_opt_arg.flags);
/*
@@ -4473,19 +4577,22 @@ syn_cmd_match(
spp->sp_cont_list = syn_opt_arg.cont_list;
spp->sp_syn.cont_in_list = syn_opt_arg.cont_in_list;
spp->sp_cchar = conceal_char;
- if (syn_opt_arg.cont_in_list != NULL)
+ if (syn_opt_arg.cont_in_list != NULL) {
curwin->w_s->b_syn_containedin = TRUE;
+ }
spp->sp_next_list = syn_opt_arg.next_list;
- /* remember that we found a match for syncing on */
- if (syn_opt_arg.flags & (HL_SYNC_HERE|HL_SYNC_THERE))
+ // remember that we found a match for syncing on
+ if (syn_opt_arg.flags & (HL_SYNC_HERE|HL_SYNC_THERE)) {
curwin->w_s->b_syn_sync_flags |= SF_MATCH;
- if (syn_opt_arg.flags & HL_FOLD)
+ }
+ if (syn_opt_arg.flags & HL_FOLD) {
++curwin->w_s->b_syn_folditems;
+ }
redraw_curbuf_later(SOME_VALID);
- syn_stack_free_all(curwin->w_s); /* Need to recompute all syntax. */
- return; /* don't free the progs and patterns now */
+ syn_stack_free_all(curwin->w_s); // Need to recompute all syntax.
+ return; // don't free the progs and patterns now
}
}
}
@@ -4499,40 +4606,37 @@ syn_cmd_match(
xfree(syn_opt_arg.cont_in_list);
xfree(syn_opt_arg.next_list);
- if (rest == NULL)
+ if (rest == NULL) {
EMSG2(_(e_invarg2), arg);
+ }
}
-/*
- * Handle ":syntax region {group-name} [matchgroup={group-name}]
- * start {start} .. [skip {skip}] end {end} .. [{options}]".
- */
-static void
-syn_cmd_region(
- exarg_T *eap,
- int syncing /* TRUE for ":syntax sync region .." */
-)
-{
- char_u *arg = eap->arg;
- char_u *group_name_end;
- char_u *rest; /* next arg, NULL on error */
- char_u *key_end;
- char_u *key = NULL;
- char_u *p;
+/// Handle ":syntax region {group-name} [matchgroup={group-name}]
+/// start {start} .. [skip {skip}] end {end} .. [{options}]".
+///
+/// @param syncing TRUE for ":syntax sync region .."
+static void syn_cmd_region(exarg_T *eap, int syncing)
+{
+ char_u *arg = eap->arg;
+ char_u *group_name_end;
+ char_u *rest; // next arg, NULL on error
+ char_u *key_end;
+ char_u *key = NULL;
+ char_u *p;
int item;
#define ITEM_START 0
#define ITEM_SKIP 1
#define ITEM_END 2
#define ITEM_MATCHGROUP 3
struct pat_ptr {
- synpat_T *pp_synp; /* pointer to syn_pattern */
- int pp_matchgroup_id; /* matchgroup ID */
- struct pat_ptr *pp_next; /* pointer to next pat_ptr */
+ synpat_T *pp_synp; // pointer to syn_pattern
+ int pp_matchgroup_id; // matchgroup ID
+ struct pat_ptr *pp_next; // pointer to next pat_ptr
} *(pat_ptrs[3]);
- /* patterns found in the line */
- struct pat_ptr *ppp;
- struct pat_ptr *ppp_next;
- int pat_count = 0; /* nr of syn_patterns found */
+ // patterns found in the line
+ struct pat_ptr *ppp;
+ struct pat_ptr *ppp_next;
+ int pat_count = 0; // nr of syn_patterns found
int syn_id;
int matchgroup_id = 0;
bool not_enough = false; // not enough arguments
@@ -4541,7 +4645,7 @@ syn_cmd_region(
syn_opt_arg_T syn_opt_arg;
int conceal_char = NUL;
- /* Isolate the group name, check for validity */
+ // Isolate the group name, check for validity
rest = get_group_name(arg, &group_name_end);
pat_ptrs[0] = NULL;
@@ -4566,10 +4670,11 @@ syn_cmd_region(
break;
}
- /* must be a pattern or matchgroup then */
+ // must be a pattern or matchgroup then
key_end = rest;
- while (*key_end && !ascii_iswhite(*key_end) && *key_end != '=')
+ while (*key_end && !ascii_iswhite(*key_end) && *key_end != '=') {
++key_end;
+ }
xfree(key);
key = vim_strnsave_up(rest, key_end - rest);
if (STRCMP(key, "MATCHGROUP") == 0) {
@@ -4601,9 +4706,9 @@ syn_cmd_region(
if (item == ITEM_MATCHGROUP) {
p = skiptowhite(rest);
- if ((p - rest == 4 && STRNCMP(rest, "NONE", 4) == 0) || eap->skip)
+ if ((p - rest == 4 && STRNCMP(rest, "NONE", 4) == 0) || eap->skip) {
matchgroup_id = 0;
- else {
+ } else {
matchgroup_id = syn_check_group(rest, (int)(p - rest));
if (matchgroup_id == 0) {
illegal = true;
@@ -4642,8 +4747,9 @@ syn_cmd_region(
}
}
xfree(key);
- if (illegal || not_enough)
+ if (illegal || not_enough) {
rest = NULL;
+ }
// Must have a "start" and "end" pattern.
if (rest != NULL && (pat_ptrs[ITEM_START] == NULL
@@ -4658,9 +4764,9 @@ syn_cmd_region(
* If OK, add the item.
*/
eap->nextcmd = check_nextcmd(rest);
- if (!ends_excmd(*rest) || eap->skip)
+ if (!ends_excmd(*rest) || eap->skip) {
rest = NULL;
- else {
+ } else {
ga_grow(&(curwin->w_s->b_syn_patterns), pat_count);
if ((syn_id = syn_check_group(arg, (int)(group_name_end - arg))) != 0) {
syn_incl_toplevel(syn_id, &syn_opt_arg.flags);
@@ -4687,15 +4793,17 @@ syn_cmd_region(
syn_opt_arg.cont_list;
SYN_ITEMS(curwin->w_s)[idx].sp_syn.cont_in_list =
syn_opt_arg.cont_in_list;
- if (syn_opt_arg.cont_in_list != NULL)
+ if (syn_opt_arg.cont_in_list != NULL) {
curwin->w_s->b_syn_containedin = TRUE;
+ }
SYN_ITEMS(curwin->w_s)[idx].sp_next_list =
syn_opt_arg.next_list;
}
++curwin->w_s->b_syn_patterns.ga_len;
++idx;
- if (syn_opt_arg.flags & HL_FOLD)
+ if (syn_opt_arg.flags & HL_FOLD) {
++curwin->w_s->b_syn_folditems;
+ }
}
}
@@ -4709,7 +4817,7 @@ syn_cmd_region(
/*
* Free the allocated memory.
*/
- for (item = ITEM_START; item <= ITEM_END; ++item)
+ for (item = ITEM_START; item <= ITEM_END; ++item) {
for (ppp = pat_ptrs[item]; ppp != NULL; ppp = ppp_next) {
if (!success && ppp->pp_synp != NULL) {
vim_regfree(ppp->pp_synp->sp_prog);
@@ -4719,15 +4827,17 @@ syn_cmd_region(
ppp_next = ppp->pp_next;
xfree(ppp);
}
+ }
if (!success) {
xfree(syn_opt_arg.cont_list);
xfree(syn_opt_arg.cont_in_list);
xfree(syn_opt_arg.next_list);
- if (not_enough)
+ if (not_enough) {
EMSG2(_("E399: Not enough arguments: syntax region %s"), arg);
- else if (illegal || rest == NULL)
+ } else if (illegal || rest == NULL) {
EMSG2(_(e_invarg2), arg);
+ }
}
}
@@ -4742,8 +4852,7 @@ static int syn_compare_stub(const void *const v1, const void *const v2)
// Combines lists of syntax clusters.
// *clstr1 and *clstr2 must both be allocated memory; they will be consumed.
-static void syn_combine_list(int16_t **const clstr1, int16_t **const clstr2,
- const int list_op)
+static void syn_combine_list(int16_t **const clstr1, int16_t **const clstr2, const int list_op)
{
size_t count1 = 0;
size_t count2 = 0;
@@ -4754,15 +4863,18 @@ static void syn_combine_list(int16_t **const clstr1, int16_t **const clstr2,
/*
* Handle degenerate cases.
*/
- if (*clstr2 == NULL)
+ if (*clstr2 == NULL) {
return;
+ }
if (*clstr1 == NULL || list_op == CLUSTER_REPLACE) {
- if (list_op == CLUSTER_REPLACE)
+ if (list_op == CLUSTER_REPLACE) {
xfree(*clstr1);
- if (list_op == CLUSTER_REPLACE || list_op == CLUSTER_ADD)
+ }
+ if (list_op == CLUSTER_REPLACE || list_op == CLUSTER_ADD) {
*clstr1 = *clstr2;
- else
+ } else {
xfree(*clstr2);
+ }
return;
}
@@ -4794,8 +4906,9 @@ static void syn_combine_list(int16_t **const clstr1, int16_t **const clstr2,
* We always want to add from the first list.
*/
if (*g1 < *g2) {
- if (round == 2)
+ if (round == 2) {
clstr[count] = *g1;
+ }
count++;
g1++;
continue;
@@ -4805,12 +4918,14 @@ static void syn_combine_list(int16_t **const clstr1, int16_t **const clstr2,
* lists.
*/
if (list_op == CLUSTER_ADD) {
- if (round == 2)
+ if (round == 2) {
clstr[count] = *g2;
+ }
count++;
}
- if (*g1 == *g2)
+ if (*g1 == *g2) {
g1++;
+ }
g2++;
}
@@ -4819,13 +4934,18 @@ static void syn_combine_list(int16_t **const clstr1, int16_t **const clstr2,
* first. As before, we only want to add from the second list if
* we're adding the lists.
*/
- for (; *g1; g1++, count++)
- if (round == 2)
+ for (; *g1; g1++, count++) {
+ if (round == 2) {
clstr[count] = *g1;
- if (list_op == CLUSTER_ADD)
- for (; *g2; g2++, count++)
- if (round == 2)
+ }
+ }
+ if (list_op == CLUSTER_ADD) {
+ for (; *g2; g2++, count++) {
+ if (round == 2) {
clstr[count] = *g2;
+ }
+ }
+ }
if (round == 1) {
/*
@@ -4885,15 +5005,16 @@ static int syn_scl_namen2id(char_u *linep, int len)
static int syn_check_cluster(char_u *pp, int len)
{
int id;
- char_u *name;
+ char_u *name;
name = vim_strnsave(pp, len);
id = syn_scl_name2id(name);
- if (id == 0) /* doesn't exist yet */
+ if (id == 0) { // doesn't exist yet
id = syn_add_cluster(name);
- else
+ } else {
xfree(name);
+ }
return id;
}
@@ -4924,30 +5045,33 @@ static int syn_add_cluster(char_u *name)
scp->scl_name_u = vim_strsave_up(name);
scp->scl_list = NULL;
- if (STRICMP(name, "Spell") == 0)
+ if (STRICMP(name, "Spell") == 0) {
curwin->w_s->b_spell_cluster_id = len + SYNID_CLUSTER;
- if (STRICMP(name, "NoSpell") == 0)
+ }
+ if (STRICMP(name, "NoSpell") == 0) {
curwin->w_s->b_nospell_cluster_id = len + SYNID_CLUSTER;
+ }
return len + SYNID_CLUSTER;
}
/*
* Handle ":syntax cluster {cluster-name} [contains={groupname},..]
- * [add={groupname},..] [remove={groupname},..]".
+ * [add={groupname},..] [remove={groupname},..]".
*/
static void syn_cmd_cluster(exarg_T *eap, int syncing)
{
- char_u *arg = eap->arg;
- char_u *group_name_end;
- char_u *rest;
+ char_u *arg = eap->arg;
+ char_u *group_name_end;
+ char_u *rest;
bool got_clstr = false;
int opt_len;
int list_op;
eap->nextcmd = find_nextcmd(arg);
- if (eap->skip)
+ if (eap->skip) {
return;
+ }
rest = get_group_name(arg, &group_name_end);
@@ -4971,8 +5095,9 @@ static void syn_cmd_cluster(exarg_T *eap, int syncing)
&& (ascii_iswhite(rest[8]) || rest[8] == '=')) {
opt_len = 8;
list_op = CLUSTER_REPLACE;
- } else
+ } else {
break;
+ }
int16_t *clstr_list = NULL;
if (get_id_list(&rest, opt_len, &clstr_list, eap->skip) == FAIL) {
@@ -4990,14 +5115,16 @@ static void syn_cmd_cluster(exarg_T *eap, int syncing)
if (got_clstr) {
redraw_curbuf_later(SOME_VALID);
- syn_stack_free_all(curwin->w_s); /* Need to recompute all. */
+ syn_stack_free_all(curwin->w_s); // Need to recompute all.
}
}
- if (!got_clstr)
+ if (!got_clstr) {
EMSG(_("E400: No cluster specified"));
- if (rest == NULL || !ends_excmd(*rest))
+ }
+ if (rest == NULL || !ends_excmd(*rest)) {
EMSG2(_(e_invarg2), arg);
+ }
}
/*
@@ -5016,10 +5143,10 @@ static void init_syn_patterns(void)
*/
static char_u *get_syn_pattern(char_u *arg, synpat_T *ci)
{
- char_u *end;
- int *p;
+ char_u *end;
+ int *p;
int idx;
- char_u *cpo_save;
+ char_u *cpo_save;
// need at least three chars
if (arg == NULL || arg[0] == NUL || arg[1] == NUL || arg[2] == NUL) {
@@ -5027,21 +5154,22 @@ static char_u *get_syn_pattern(char_u *arg, synpat_T *ci)
}
end = skip_regexp(arg + 1, *arg, TRUE, NULL);
- if (*end != *arg) { /* end delimiter not found */
+ if (*end != *arg) { // end delimiter not found
EMSG2(_("E401: Pattern delimiter not found: %s"), arg);
return NULL;
}
// store the pattern and compiled regexp program
ci->sp_pattern = vim_strnsave(arg + 1, end - arg - 1);
- /* Make 'cpoptions' empty, to avoid the 'l' flag */
+ // Make 'cpoptions' empty, to avoid the 'l' flag
cpo_save = p_cpo;
p_cpo = (char_u *)"";
ci->sp_prog = vim_regcomp(ci->sp_pattern, RE_MAGIC);
p_cpo = cpo_save;
- if (ci->sp_prog == NULL)
+ if (ci->sp_prog == NULL) {
return NULL;
+ }
ci->sp_ic = curwin->w_s->b_syn_ic;
syn_clear_time(&ci->sp_time);
@@ -5050,41 +5178,49 @@ static char_u *get_syn_pattern(char_u *arg, synpat_T *ci)
*/
++end;
do {
- for (idx = SPO_COUNT; --idx >= 0; )
- if (STRNCMP(end, spo_name_tab[idx], 3) == 0)
+ for (idx = SPO_COUNT; --idx >= 0; ) {
+ if (STRNCMP(end, spo_name_tab[idx], 3) == 0) {
break;
+ }
+ }
if (idx >= 0) {
p = &(ci->sp_offsets[idx]);
- if (idx != SPO_LC_OFF)
+ if (idx != SPO_LC_OFF) {
switch (end[3]) {
- case 's': break;
- case 'b': break;
- case 'e': idx += SPO_COUNT; break;
- default: idx = -1; break;
+ case 's':
+ break;
+ case 'b':
+ break;
+ case 'e':
+ idx += SPO_COUNT; break;
+ default:
+ idx = -1; break;
}
+ }
if (idx >= 0) {
ci->sp_off_flags |= (1 << idx);
- if (idx == SPO_LC_OFF) { /* lc=99 */
+ if (idx == SPO_LC_OFF) { // lc=99
end += 3;
*p = getdigits_int(&end, true, 0);
- /* "lc=" offset automatically sets "ms=" offset */
+ // "lc=" offset automatically sets "ms=" offset
if (!(ci->sp_off_flags & (1 << SPO_MS_OFF))) {
ci->sp_off_flags |= (1 << SPO_MS_OFF);
ci->sp_offsets[SPO_MS_OFF] = *p;
}
- } else { /* yy=x+99 */
+ } else { // yy=x+99
end += 4;
if (*end == '+') {
end++;
*p = getdigits_int(&end, true, 0); // positive offset
- } else if (*end == '-') {
+ } else if (*end == '-') {
end++;
*p = -getdigits_int(&end, true, 0); // negative offset
}
}
- if (*end != ',')
+ if (*end != ',') {
break;
+ }
++end;
}
}
@@ -5102,14 +5238,14 @@ static char_u *get_syn_pattern(char_u *arg, synpat_T *ci)
*/
static void syn_cmd_sync(exarg_T *eap, int syncing)
{
- char_u *arg_start = eap->arg;
- char_u *arg_end;
- char_u *key = NULL;
- char_u *next_arg;
+ char_u *arg_start = eap->arg;
+ char_u *arg_end;
+ char_u *key = NULL;
+ char_u *next_arg;
int illegal = FALSE;
int finished = FALSE;
long n;
- char_u *cpo_save;
+ char_u *cpo_save;
if (ends_excmd(*arg_start)) {
syn_cmd_list(eap, TRUE);
@@ -5122,45 +5258,50 @@ static void syn_cmd_sync(exarg_T *eap, int syncing)
xfree(key);
key = vim_strnsave_up(arg_start, arg_end - arg_start);
if (STRCMP(key, "CCOMMENT") == 0) {
- if (!eap->skip)
+ if (!eap->skip) {
curwin->w_s->b_syn_sync_flags |= SF_CCOMMENT;
+ }
if (!ends_excmd(*next_arg)) {
arg_end = skiptowhite(next_arg);
- if (!eap->skip)
+ if (!eap->skip) {
curwin->w_s->b_syn_sync_id = syn_check_group(next_arg,
- (int)(arg_end - next_arg));
+ (int)(arg_end - next_arg));
+ }
next_arg = skipwhite(arg_end);
- } else if (!eap->skip)
+ } else if (!eap->skip) {
curwin->w_s->b_syn_sync_id = syn_name2id((char_u *)"Comment");
- } else if ( STRNCMP(key, "LINES", 5) == 0
- || STRNCMP(key, "MINLINES", 8) == 0
- || STRNCMP(key, "MAXLINES", 8) == 0
- || STRNCMP(key, "LINEBREAKS", 10) == 0) {
- if (key[4] == 'S')
+ }
+ } else if (STRNCMP(key, "LINES", 5) == 0
+ || STRNCMP(key, "MINLINES", 8) == 0
+ || STRNCMP(key, "MAXLINES", 8) == 0
+ || STRNCMP(key, "LINEBREAKS", 10) == 0) {
+ if (key[4] == 'S') {
arg_end = key + 6;
- else if (key[0] == 'L')
+ } else if (key[0] == 'L') {
arg_end = key + 11;
- else
+ } else {
arg_end = key + 9;
+ }
if (arg_end[-1] != '=' || !ascii_isdigit(*arg_end)) {
illegal = TRUE;
break;
}
n = getdigits_long(&arg_end, false, 0);
if (!eap->skip) {
- if (key[4] == 'B')
+ if (key[4] == 'B') {
curwin->w_s->b_syn_sync_linebreaks = n;
- else if (key[1] == 'A')
+ } else if (key[1] == 'A') {
curwin->w_s->b_syn_sync_maxlines = n;
- else
+ } else {
curwin->w_s->b_syn_sync_minlines = n;
+ }
}
- } else if (STRCMP(key, "FROMSTART") == 0) {
+ } else if (STRCMP(key, "FROMSTART") == 0) {
if (!eap->skip) {
curwin->w_s->b_syn_sync_minlines = MAXLNUM;
curwin->w_s->b_syn_sync_maxlines = 0;
}
- } else if (STRCMP(key, "LINECONT") == 0) {
+ } else if (STRCMP(key, "LINECONT") == 0) {
if (*next_arg == NUL) { // missing pattern
illegal = true;
break;
@@ -5171,18 +5312,18 @@ static void syn_cmd_sync(exarg_T *eap, int syncing)
break;
}
arg_end = skip_regexp(next_arg + 1, *next_arg, TRUE, NULL);
- if (*arg_end != *next_arg) { /* end delimiter not found */
+ if (*arg_end != *next_arg) { // end delimiter not found
illegal = TRUE;
break;
}
if (!eap->skip) {
- /* store the pattern and compiled regexp program */
+ // store the pattern and compiled regexp program
curwin->w_s->b_syn_linecont_pat =
vim_strnsave(next_arg + 1, arg_end - next_arg - 1);
curwin->w_s->b_syn_linecont_ic = curwin->w_s->b_syn_ic;
- /* Make 'cpoptions' empty, to avoid the 'l' flag */
+ // Make 'cpoptions' empty, to avoid the 'l' flag
cpo_save = p_cpo;
p_cpo = (char_u *)"";
curwin->w_s->b_syn_linecont_prog =
@@ -5199,47 +5340,43 @@ static void syn_cmd_sync(exarg_T *eap, int syncing)
next_arg = skipwhite(arg_end + 1);
} else {
eap->arg = next_arg;
- if (STRCMP(key, "MATCH") == 0)
+ if (STRCMP(key, "MATCH") == 0) {
syn_cmd_match(eap, TRUE);
- else if (STRCMP(key, "REGION") == 0)
+ } else if (STRCMP(key, "REGION") == 0) {
syn_cmd_region(eap, TRUE);
- else if (STRCMP(key, "CLEAR") == 0)
+ } else if (STRCMP(key, "CLEAR") == 0) {
syn_cmd_clear(eap, TRUE);
- else
+ } else {
illegal = TRUE;
+ }
finished = TRUE;
break;
}
arg_start = next_arg;
}
xfree(key);
- if (illegal)
+ if (illegal) {
EMSG2(_("E404: Illegal arguments: %s"), arg_start);
- else if (!finished) {
+ } else if (!finished) {
eap->nextcmd = check_nextcmd(arg_start);
redraw_curbuf_later(SOME_VALID);
- syn_stack_free_all(curwin->w_s); /* Need to recompute all syntax. */
+ syn_stack_free_all(curwin->w_s); // Need to recompute all syntax.
}
}
-/*
- * Convert a line of highlight group names into a list of group ID numbers.
- * "arg" should point to the "contains" or "nextgroup" keyword.
- * "arg" is advanced to after the last group name.
- * Careful: the argument is modified (NULs added).
- * returns FAIL for some error, OK for success.
- */
-static int
-get_id_list(
- char_u **const arg,
- const int keylen, // length of keyword
- int16_t **const list, // where to store the resulting list, if not
- // NULL, the list is silently skipped!
- const bool skip
-)
-{
- char_u *p = NULL;
- char_u *end;
+/// Convert a line of highlight group names into a list of group ID numbers.
+/// "arg" should point to the "contains" or "nextgroup" keyword.
+/// "arg" is advanced to after the last group name.
+/// Careful: the argument is modified (NULs added).
+///
+/// @param keylen length of keyword
+/// @param list where to store the resulting list, if not NULL, the list is silently skipped!
+///
+/// @return FAIL for some error, OK for success.
+static int get_id_list(char_u **const arg, const int keylen, int16_t **const list, const bool skip)
+{
+ char_u *p = NULL;
+ char_u *end;
int total_count = 0;
int16_t *retval = NULL;
regmatch_T regmatch;
@@ -5271,10 +5408,10 @@ get_id_list(
}
char_u *const name = xmalloc((int)(end - p + 3)); // leave room for "^$"
STRLCPY(name + 1, p, end - p + 1);
- if ( STRCMP(name + 1, "ALLBUT") == 0
- || STRCMP(name + 1, "ALL") == 0
- || STRCMP(name + 1, "TOP") == 0
- || STRCMP(name + 1, "CONTAINED") == 0) {
+ if (STRCMP(name + 1, "ALLBUT") == 0
+ || STRCMP(name + 1, "ALL") == 0
+ || STRCMP(name + 1, "TOP") == 0
+ || STRCMP(name + 1, "CONTAINED") == 0) {
if (TOUPPER_ASC(**arg) != 'C') {
EMSG2(_("E407: %s not allowed here"), name + 1);
failed = true;
@@ -5299,7 +5436,7 @@ get_id_list(
} else {
id = SYNID_CONTAINED + current_syn_inc_tag;
}
- } else if (name[1] == '@') {
+ } else if (name[1] == '@') {
if (skip) {
id = -1;
} else {
@@ -5364,12 +5501,14 @@ get_id_list(
++count;
}
p = skipwhite(end);
- if (*p != ',')
+ if (*p != ',') {
break;
- p = skipwhite(p + 1); /* skip comma in between arguments */
+ }
+ p = skipwhite(p + 1); // skip comma in between arguments
} while (!ends_excmd(*p));
- if (failed)
+ if (failed) {
break;
+ }
if (round == 1) {
retval = xmalloc((count + 1) * sizeof(*retval));
retval[count] = 0; // zero means end of the list
@@ -5383,11 +5522,11 @@ get_id_list(
return FAIL;
}
- if (*list == NULL)
+ if (*list == NULL) {
*list = retval;
- else
- xfree(retval); /* list already found, don't overwrite it */
-
+ } else {
+ xfree(retval); // list already found, don't overwrite it
+ }
return OK;
}
@@ -5410,20 +5549,17 @@ static int16_t *copy_id_list(const int16_t *const list)
return retval;
}
-/*
- * Check if syntax group "ssp" is in the ID list "list" of "cur_si".
- * "cur_si" can be NULL if not checking the "containedin" list.
- * Used to check if a syntax item is in the "contains" or "nextgroup" list of
- * the current item.
- * This function is called very often, keep it fast!!
- */
-static int
-in_id_list(
- stateitem_T *cur_si, // current item or NULL
- int16_t *list, // id list
- struct sp_syn *ssp, // group id and ":syn include" tag of group
- int contained // group id is contained
-)
+/// Check if syntax group "ssp" is in the ID list "list" of "cur_si".
+/// "cur_si" can be NULL if not checking the "containedin" list.
+/// Used to check if a syntax item is in the "contains" or "nextgroup" list of
+/// the current item.
+/// This function is called very often, keep it fast!!
+///
+/// @param cur_si current item or NULL
+/// @param list id list
+/// @param ssp group id and ":syn include" tag of group
+/// @param contained group id is contained
+static int in_id_list(stateitem_T *cur_si, int16_t *list, struct sp_syn *ssp, int contained)
{
int retval;
int16_t *scl_list;
@@ -5432,30 +5568,35 @@ in_id_list(
static int depth = 0;
int r;
- /* If ssp has a "containedin" list and "cur_si" is in it, return TRUE. */
+ // If ssp has a "containedin" list and "cur_si" is in it, return TRUE.
if (cur_si != NULL && ssp->cont_in_list != NULL
&& !(cur_si->si_flags & HL_MATCH)) {
/* Ignore transparent items without a contains argument. Double check
* that we don't go back past the first one. */
while ((cur_si->si_flags & HL_TRANS_CONT)
- && cur_si > (stateitem_T *)(current_state.ga_data))
+ && cur_si > (stateitem_T *)(current_state.ga_data)) {
--cur_si;
- /* cur_si->si_idx is -1 for keywords, these never contain anything. */
+ }
+ // cur_si->si_idx is -1 for keywords, these never contain anything.
if (cur_si->si_idx >= 0 && in_id_list(NULL, ssp->cont_in_list,
- &(SYN_ITEMS(syn_block)[cur_si->si_idx].sp_syn),
- SYN_ITEMS(syn_block)[cur_si->si_idx].sp_flags & HL_CONTAINED))
+ &(SYN_ITEMS(syn_block)[cur_si->si_idx].sp_syn),
+ SYN_ITEMS(syn_block)[cur_si->si_idx].sp_flags &
+ HL_CONTAINED)) {
return TRUE;
+ }
}
- if (list == NULL)
+ if (list == NULL) {
return FALSE;
+ }
/*
* If list is ID_LIST_ALL, we are in a transparent item that isn't
* inside anything. Only allow not-contained groups.
*/
- if (list == ID_LIST_ALL)
+ if (list == ID_LIST_ALL) {
return !contained;
+ }
/*
* If the first item is "ALLBUT", return TRUE if "id" is NOT in the
@@ -5465,29 +5606,34 @@ in_id_list(
item = *list;
if (item >= SYNID_ALLBUT && item < SYNID_CLUSTER) {
if (item < SYNID_TOP) {
- /* ALL or ALLBUT: accept all groups in the same file */
- if (item - SYNID_ALLBUT != ssp->inc_tag)
+ // ALL or ALLBUT: accept all groups in the same file
+ if (item - SYNID_ALLBUT != ssp->inc_tag) {
return FALSE;
- } else if (item < SYNID_CONTAINED) {
- /* TOP: accept all not-contained groups in the same file */
- if (item - SYNID_TOP != ssp->inc_tag || contained)
+ }
+ } else if (item < SYNID_CONTAINED) {
+ // TOP: accept all not-contained groups in the same file
+ if (item - SYNID_TOP != ssp->inc_tag || contained) {
return FALSE;
+ }
} else {
- /* CONTAINED: accept all contained groups in the same file */
- if (item - SYNID_CONTAINED != ssp->inc_tag || !contained)
+ // CONTAINED: accept all contained groups in the same file
+ if (item - SYNID_CONTAINED != ssp->inc_tag || !contained) {
return FALSE;
+ }
}
item = *++list;
retval = FALSE;
- } else
+ } else {
retval = TRUE;
+ }
/*
* Return "retval" if id is in the contains list.
*/
while (item != 0) {
- if (item == id)
+ if (item == id) {
return retval;
+ }
if (item >= SYNID_CLUSTER) {
scl_list = SYN_CLSTR(syn_block)[item - SYNID_CLUSTER].scl_list;
/* restrict recursiveness to 30 to avoid an endless loop for a
@@ -5496,8 +5642,9 @@ in_id_list(
++depth;
r = in_id_list(NULL, scl_list, ssp, contained);
--depth;
- if (r)
+ if (r) {
return retval;
+ }
}
}
item = *++list;
@@ -5506,8 +5653,8 @@ in_id_list(
}
struct subcommand {
- char *name; /* subcommand name */
- void (*func)(exarg_T *, int); /* function to call */
+ char *name; // subcommand name
+ void (*func)(exarg_T *, int); // function to call
};
static struct subcommand subcommands[] =
@@ -5541,8 +5688,8 @@ static struct subcommand subcommands[] =
*/
void ex_syntax(exarg_T *eap)
{
- char_u *arg = eap->arg;
- char_u *subcmd_end;
+ char_u *arg = eap->arg;
+ char_u *subcmd_end;
syn_cmdlinep = eap->cmdlinep;
@@ -5565,14 +5712,15 @@ void ex_syntax(exarg_T *eap)
}
}
xfree(subcmd_name);
- if (eap->skip)
+ if (eap->skip) {
--emsg_skip;
+ }
}
void ex_ownsyntax(exarg_T *eap)
{
- char_u *old_value;
- char_u *new_value;
+ char_u *old_value;
+ char_u *new_value;
if (curwin->w_s == &curwin->w_buffer->b_s) {
curwin->w_s = xmalloc(sizeof(synblock_T));
@@ -5662,7 +5810,7 @@ void set_context_in_syntax_cmd(expand_T *xp, const char *arg)
include_link = 0;
include_default = 0;
- /* (part of) subcommand already typed */
+ // (part of) subcommand already typed
if (*arg != NUL) {
const char *p = (const char *)skiptowhite((const char_u *)arg);
if (*p != NUL) { // Past first word.
@@ -5694,47 +5842,44 @@ void set_context_in_syntax_cmd(expand_T *xp, const char *arg)
char_u *get_syntax_name(expand_T *xp, int idx)
{
switch (expand_what) {
- case EXP_SUBCMD:
- return (char_u *)subcommands[idx].name;
- case EXP_CASE: {
- static char *case_args[] = { "match", "ignore", NULL };
- return (char_u *)case_args[idx];
+ case EXP_SUBCMD:
+ return (char_u *)subcommands[idx].name;
+ case EXP_CASE: {
+ static char *case_args[] = { "match", "ignore", NULL };
+ return (char_u *)case_args[idx];
}
- case EXP_SPELL: {
- static char *spell_args[] =
- { "toplevel", "notoplevel", "default", NULL };
- return (char_u *)spell_args[idx];
+ case EXP_SPELL: {
+ static char *spell_args[] =
+ { "toplevel", "notoplevel", "default", NULL };
+ return (char_u *)spell_args[idx];
}
- case EXP_SYNC: {
- static char *sync_args[] =
- { "ccomment", "clear", "fromstart",
- "linebreaks=", "linecont", "lines=", "match",
- "maxlines=", "minlines=", "region", NULL };
- return (char_u *)sync_args[idx];
+ case EXP_SYNC: {
+ static char *sync_args[] =
+ { "ccomment", "clear", "fromstart",
+ "linebreaks=", "linecont", "lines=", "match",
+ "maxlines=", "minlines=", "region", NULL };
+ return (char_u *)sync_args[idx];
}
}
return NULL;
}
-// Function called for expression evaluation: get syntax ID at file position.
-int syn_get_id(
- win_T *wp,
- long lnum,
- colnr_T col,
- int trans, // remove transparency
- bool *spellp, // return: can do spell checking
- int keep_state // keep state of char at "col"
-)
+/// Function called for expression evaluation: get syntax ID at file position.
+///
+/// @param trans remove transparency
+/// @param spellp return: can do spell checking
+/// @param keep_state keep state of char at "col"
+int syn_get_id(win_T *wp, long lnum, colnr_T col, int trans, bool *spellp, int keep_state)
{
// When the position is not after the current position and in the same
// line of the same buffer, need to restart parsing.
if (wp->w_buffer != syn_buf || lnum != current_lnum || col < current_col) {
syntax_start(wp, lnum);
} else if (col > current_col) {
- // next_match may not be correct when moving around, e.g. with the
- // "skip" expression in searchpair()
- next_match_idx = -1;
+ // next_match may not be correct when moving around, e.g. with the
+ // "skip" expression in searchpair()
+ next_match_idx = -1;
}
(void)get_syntax_attr(col, spellp, keep_state);
@@ -5842,8 +5987,9 @@ int syn_get_foldlevel(win_T *wp, long lnum)
}
if (level > wp->w_p_fdn) {
level = wp->w_p_fdn;
- if (level < 0)
+ if (level < 0) {
level = 0;
+ }
}
return level;
}
@@ -5879,7 +6025,7 @@ static void syn_clear_time(syn_time_T *st)
*/
static void syntime_clear(void)
{
- synpat_T *spp;
+ synpat_T *spp;
if (!syntax_present(curwin)) {
MSG(_(msg_no_items));
@@ -5898,18 +6044,22 @@ static void syntime_clear(void)
char_u *get_syntime_arg(expand_T *xp, int idx)
{
switch (idx) {
- case 0: return (char_u *)"on";
- case 1: return (char_u *)"off";
- case 2: return (char_u *)"clear";
- case 3: return (char_u *)"report";
+ case 0:
+ return (char_u *)"on";
+ case 1:
+ return (char_u *)"off";
+ case 2:
+ return (char_u *)"clear";
+ case 3:
+ return (char_u *)"report";
}
return NULL;
}
static int syn_compare_syntime(const void *v1, const void *v2)
{
- const time_entry_T *s1 = v1;
- const time_entry_T *s2 = v2;
+ const time_entry_T *s1 = v1;
+ const time_entry_T *s2 = v2;
return profile_cmp(s1->total, s2->total);
}
@@ -5954,14 +6104,13 @@ static void syntime_report(void)
syn_compare_syntime);
}
- MSG_PUTS_TITLE(_(
- " TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN"));
+ MSG_PUTS_TITLE(_(" TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN"));
MSG_PUTS("\n");
for (int idx = 0; idx < ga.ga_len && !got_int; ++idx) {
p = ((time_entry_T *)ga.ga_data) + idx;
MSG_PUTS(profile_msg(p->total));
- MSG_PUTS(" "); /* make sure there is always a separating space */
+ MSG_PUTS(" "); // make sure there is always a separating space
msg_advance(13);
msg_outnum(p->count);
MSG_PUTS(" ");
@@ -5980,12 +6129,14 @@ static void syntime_report(void)
msg_advance(69);
int len;
- if (Columns < 80)
- len = 20; /* will wrap anyway */
- else
+ if (Columns < 80) {
+ len = 20; // will wrap anyway
+ } else {
len = Columns - 70;
- if (len > (int)STRLEN(p->pattern))
+ }
+ if (len > (int)STRLEN(p->pattern)) {
len = (int)STRLEN(p->pattern);
+ }
msg_outtrans_len(p->pattern, len);
MSG_PUTS("\n");
}
@@ -6000,7 +6151,7 @@ static void syntime_report(void)
}
/**************************************
-* Highlighting stuff *
+* Highlighting stuff *
**************************************/
// The default highlight groups. These are compiled-in for fast startup and
@@ -6009,8 +6160,7 @@ static void syntime_report(void)
// When making changes here, also change runtime/colors/default.vim!
static const char *highlight_init_both[] = {
- "Conceal "
- "ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey",
+ "Conceal ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey",
"Cursor guibg=fg guifg=bg",
"lCursor guibg=fg guifg=bg",
"DiffText cterm=bold ctermbg=Red gui=bold guibg=Red",
@@ -6042,10 +6192,8 @@ static const char *highlight_init_both[] = {
"RedrawDebugClear ctermbg=Yellow guibg=Yellow",
"RedrawDebugComposed ctermbg=Green guibg=Green",
"RedrawDebugRecompose ctermbg=Red guibg=Red",
- "Error term=reverse cterm=NONE ctermfg=White ctermbg=Red gui=NONE "
- "guifg=White guibg=Red",
- "Todo term=standout cterm=NONE ctermfg=Black ctermbg=Yellow gui=NONE "
- "guifg=Blue guibg=Yellow",
+ "Error term=reverse cterm=NONE ctermfg=White ctermbg=Red gui=NONE guifg=White guibg=Red",
+ "Todo term=standout cterm=NONE ctermfg=Black ctermbg=Yellow gui=NONE guifg=Blue guibg=Yellow",
"default link String Constant",
"default link Character Constant",
"default link Number Constant",
@@ -6103,24 +6251,15 @@ static const char *highlight_init_light[] = {
"Title ctermfg=DarkMagenta gui=bold guifg=Magenta",
"Visual guibg=LightGrey",
"WarningMsg ctermfg=DarkRed guifg=Red",
- "Comment term=bold cterm=NONE ctermfg=DarkBlue ctermbg=NONE "
- "gui=NONE guifg=Blue guibg=NONE",
- "Constant term=underline cterm=NONE ctermfg=DarkRed ctermbg=NONE "
- "gui=NONE guifg=Magenta guibg=NONE",
- "Special term=bold cterm=NONE ctermfg=DarkMagenta ctermbg=NONE "
- "gui=NONE guifg=#6a5acd guibg=NONE",
- "Identifier term=underline cterm=NONE ctermfg=DarkCyan ctermbg=NONE "
- "gui=NONE guifg=DarkCyan guibg=NONE",
- "Statement term=bold cterm=NONE ctermfg=Brown ctermbg=NONE "
- "gui=bold guifg=Brown guibg=NONE",
- "PreProc term=underline cterm=NONE ctermfg=DarkMagenta ctermbg=NONE "
- "gui=NONE guifg=#6a0dad guibg=NONE",
- "Type term=underline cterm=NONE ctermfg=DarkGreen ctermbg=NONE "
- "gui=bold guifg=SeaGreen guibg=NONE",
- "Underlined term=underline cterm=underline ctermfg=DarkMagenta "
- "gui=underline guifg=SlateBlue",
- "Ignore term=NONE cterm=NONE ctermfg=white ctermbg=NONE "
- "gui=NONE guifg=bg guibg=NONE",
+ "Comment term=bold cterm=NONE ctermfg=DarkBlue ctermbg=NONE gui=NONE guifg=Blue guibg=NONE",
+ "Constant term=underline cterm=NONE ctermfg=DarkRed ctermbg=NONE gui=NONE guifg=Magenta guibg=NONE",
+ "Special term=bold cterm=NONE ctermfg=DarkMagenta ctermbg=NONE gui=NONE guifg=#6a5acd guibg=NONE",
+ "Identifier term=underline cterm=NONE ctermfg=DarkCyan ctermbg=NONE gui=NONE guifg=DarkCyan guibg=NONE",
+ "Statement term=bold cterm=NONE ctermfg=Brown ctermbg=NONE gui=bold guifg=Brown guibg=NONE",
+ "PreProc term=underline cterm=NONE ctermfg=DarkMagenta ctermbg=NONE gui=NONE guifg=#6a0dad guibg=NONE",
+ "Type term=underline cterm=NONE ctermfg=DarkGreen ctermbg=NONE gui=bold guifg=SeaGreen guibg=NONE",
+ "Underlined term=underline cterm=underline ctermfg=DarkMagenta gui=underline guifg=SlateBlue",
+ "Ignore term=NONE cterm=NONE ctermfg=white ctermbg=NONE gui=NONE guifg=bg guibg=NONE",
NULL
};
@@ -6154,24 +6293,15 @@ static const char *highlight_init_dark[] = {
"Title ctermfg=LightMagenta gui=bold guifg=Magenta",
"Visual guibg=DarkGrey",
"WarningMsg ctermfg=LightRed guifg=Red",
- "Comment term=bold cterm=NONE ctermfg=Cyan ctermbg=NONE "
- "gui=NONE guifg=#80a0ff guibg=NONE",
- "Constant term=underline cterm=NONE ctermfg=Magenta ctermbg=NONE "
- "gui=NONE guifg=#ffa0a0 guibg=NONE",
- "Special term=bold cterm=NONE ctermfg=LightRed ctermbg=NONE "
- "gui=NONE guifg=Orange guibg=NONE",
- "Identifier term=underline cterm=bold ctermfg=Cyan ctermbg=NONE "
- "gui=NONE guifg=#40ffff guibg=NONE",
- "Statement term=bold cterm=NONE ctermfg=Yellow ctermbg=NONE "
- "gui=bold guifg=#ffff60 guibg=NONE",
- "PreProc term=underline cterm=NONE ctermfg=LightBlue ctermbg=NONE "
- "gui=NONE guifg=#ff80ff guibg=NONE",
- "Type term=underline cterm=NONE ctermfg=LightGreen ctermbg=NONE "
- "gui=bold guifg=#60ff60 guibg=NONE",
- "Underlined term=underline cterm=underline ctermfg=LightBlue "
- "gui=underline guifg=#80a0ff",
- "Ignore term=NONE cterm=NONE ctermfg=black ctermbg=NONE "
- "gui=NONE guifg=bg guibg=NONE",
+ "Comment term=bold cterm=NONE ctermfg=Cyan ctermbg=NONE gui=NONE guifg=#80a0ff guibg=NONE",
+ "Constant term=underline cterm=NONE ctermfg=Magenta ctermbg=NONE gui=NONE guifg=#ffa0a0 guibg=NONE",
+ "Special term=bold cterm=NONE ctermfg=LightRed ctermbg=NONE gui=NONE guifg=Orange guibg=NONE",
+ "Identifier term=underline cterm=bold ctermfg=Cyan ctermbg=NONE gui=NONE guifg=#40ffff guibg=NONE",
+ "Statement term=bold cterm=NONE ctermfg=Yellow ctermbg=NONE gui=bold guifg=#ffff60 guibg=NONE",
+ "PreProc term=underline cterm=NONE ctermfg=LightBlue ctermbg=NONE gui=NONE guifg=#ff80ff guibg=NONE",
+ "Type term=underline cterm=NONE ctermfg=LightGreen ctermbg=NONE gui=bold guifg=#60ff60 guibg=NONE",
+ "Underlined term=underline cterm=underline ctermfg=LightBlue gui=underline guifg=#80a0ff",
+ "Ignore term=NONE cterm=NONE ctermfg=black ctermbg=NONE gui=NONE guifg=bg guibg=NONE",
NULL
};
@@ -6278,12 +6408,9 @@ const char *const highlight_init_cmdline[] = {
"default link NvimInvalidAssignment NvimInvalid",
"default link NvimInvalidPlainAssignment NvimInvalidAssignment",
"default link NvimInvalidAugmentedAssignment NvimInvalidAssignment",
- "default link NvimInvalidAssignmentWithAddition "
- "NvimInvalidAugmentedAssignment",
- "default link NvimInvalidAssignmentWithSubtraction "
- "NvimInvalidAugmentedAssignment",
- "default link NvimInvalidAssignmentWithConcatenation "
- "NvimInvalidAugmentedAssignment",
+ "default link NvimInvalidAssignmentWithAddition NvimInvalidAugmentedAssignment",
+ "default link NvimInvalidAssignmentWithSubtraction NvimInvalidAugmentedAssignment",
+ "default link NvimInvalidAssignmentWithConcatenation NvimInvalidAugmentedAssignment",
"default link NvimInvalidOperator NvimInvalid",
@@ -6345,7 +6472,7 @@ const char *const highlight_init_cmdline[] = {
"default link NvimInvalidOptionName NvimInvalidIdentifier",
"default link NvimInvalidOptionScope NvimInvalidIdentifierScope",
"default link NvimInvalidOptionScopeDelimiter "
- "NvimInvalidIdentifierScopeDelimiter",
+ "NvimInvalidIdentifierScopeDelimiter",
"default link NvimInvalidEnvironmentSigil NvimInvalidOptionSigil",
"default link NvimInvalidEnvironmentName NvimInvalidIdentifier",
@@ -6403,7 +6530,7 @@ void init_highlight(bool both, bool reset)
bool okay = load_colors(copy_p);
xfree(copy_p);
if (okay) {
- return;
+ return;
}
}
@@ -6436,8 +6563,7 @@ void init_highlight(bool both, bool reset)
* to avoid Statement highlighted text disappears.
* Clear the attributes, needed when changing the t_Co value. */
if (t_colors > 8) {
- do_highlight(
- (*p_bg == 'l'
+ do_highlight((*p_bg == 'l'
? "Visual cterm=NONE ctermbg=LightGrey"
: "Visual cterm=NONE ctermbg=DarkGrey"), false, true);
} else {
@@ -6456,7 +6582,7 @@ void init_highlight(bool both, bool reset)
*/
int load_colors(char_u *name)
{
- char_u *buf;
+ char_u *buf;
int retval = FAIL;
static bool recursive = false;
@@ -6492,46 +6618,47 @@ static char *(color_names[28]) = {
"DarkGray", "DarkGrey",
"Blue", "LightBlue", "Green", "LightGreen",
"Cyan", "LightCyan", "Red", "LightRed", "Magenta",
- "LightMagenta", "Yellow", "LightYellow", "White", "NONE" };
- // indices:
- // 0, 1, 2, 3,
- // 4, 5, 6, 7,
- // 8, 9, 10, 11,
- // 12, 13,
- // 14, 15, 16, 17,
- // 18, 19, 20, 21, 22,
- // 23, 24, 25, 26, 27
+ "LightMagenta", "Yellow", "LightYellow", "White", "NONE"
+};
+// indices:
+// 0, 1, 2, 3,
+// 4, 5, 6, 7,
+// 8, 9, 10, 11,
+// 12, 13,
+// 14, 15, 16, 17,
+// 18, 19, 20, 21, 22,
+// 23, 24, 25, 26, 27
static int color_numbers_16[28] = { 0, 1, 2, 3,
- 4, 5, 6, 6,
- 7, 7, 7, 7,
- 8, 8,
- 9, 9, 10, 10,
- 11, 11, 12, 12, 13,
- 13, 14, 14, 15, -1 };
+ 4, 5, 6, 6,
+ 7, 7, 7, 7,
+ 8, 8,
+ 9, 9, 10, 10,
+ 11, 11, 12, 12, 13,
+ 13, 14, 14, 15, -1 };
// for xterm with 88 colors...
static int color_numbers_88[28] = { 0, 4, 2, 6,
- 1, 5, 32, 72,
- 84, 84, 7, 7,
- 82, 82,
- 12, 43, 10, 61,
- 14, 63, 9, 74, 13,
- 75, 11, 78, 15, -1 };
+ 1, 5, 32, 72,
+ 84, 84, 7, 7,
+ 82, 82,
+ 12, 43, 10, 61,
+ 14, 63, 9, 74, 13,
+ 75, 11, 78, 15, -1 };
// for xterm with 256 colors...
static int color_numbers_256[28] = { 0, 4, 2, 6,
- 1, 5, 130, 3,
- 248, 248, 7, 7,
- 242, 242,
- 12, 81, 10, 121,
- 14, 159, 9, 224, 13,
- 225, 11, 229, 15, -1 };
+ 1, 5, 130, 3,
+ 248, 248, 7, 7,
+ 242, 242,
+ 12, 81, 10, 121,
+ 14, 159, 9, 224, 13,
+ 225, 11, 229, 15, -1 };
// for terminals with less than 16 colors...
static int color_numbers_8[28] = { 0, 4, 2, 6,
- 1, 5, 3, 3,
- 7, 7, 7, 7,
- 0+8, 0+8,
- 4+8, 4+8, 2+8, 2+8,
- 6+8, 6+8, 1+8, 1+8, 5+8,
- 5+8, 3+8, 3+8, 7+8, -1 };
+ 1, 5, 3, 3,
+ 7, 7, 7, 7,
+ 0+8, 0+8,
+ 4+8, 4+8, 2+8, 2+8,
+ 6+8, 6+8, 1+8, 1+8, 5+8,
+ 5+8, 3+8, 3+8, 7+8, -1 };
// Lookup the "cterm" value to be used for color with index "idx" in
// color_names[].
@@ -6849,7 +6976,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
if (error) {
break;
}
- if (*key == 'C') {
+ if (*key == 'C') {
if (!init || !(HL_TABLE()[idx].sg_set & SG_CTERM)) {
if (!init) {
HL_TABLE()[idx].sg_set |= SG_CTERM;
@@ -6865,7 +6992,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
HL_TABLE()[idx].sg_gui = attr;
}
}
- } else if (STRCMP(key, "FONT") == 0) {
+ } else if (STRCMP(key, "FONT") == 0) {
// in non-GUI fonts are simply ignored
} else if (STRCMP(key, "CTERMFG") == 0 || STRCMP(key, "CTERMBG") == 0) {
if (!init || !(HL_TABLE()[idx].sg_set & SG_CTERM)) {
@@ -6890,10 +7017,10 @@ void do_highlight(const char *line, const bool forceit, const bool init)
error = true;
break;
}
- } else if (STRICMP(arg, "bg") == 0) {
- if (cterm_normal_bg_color > 0)
+ } else if (STRICMP(arg, "bg") == 0) {
+ if (cterm_normal_bg_color > 0) {
color = cterm_normal_bg_color - 1;
- else {
+ } else {
EMSG(_("E420: BG color unknown"));
error = true;
break;
@@ -6960,7 +7087,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
}
}
}
- } else if (strcmp(key, "GUIFG") == 0) {
+ } else if (strcmp(key, "GUIFG") == 0) {
char **namep = &HL_TABLE()[idx].sg_rgb_fg_name;
if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) {
@@ -6984,7 +7111,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
if (is_normal_group) {
normal_fg = HL_TABLE()[idx].sg_rgb_fg;
}
- } else if (STRCMP(key, "GUIBG") == 0) {
+ } else if (STRCMP(key, "GUIBG") == 0) {
char **const namep = &HL_TABLE()[idx].sg_rgb_bg_name;
if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) {
@@ -7008,7 +7135,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
if (is_normal_group) {
normal_bg = HL_TABLE()[idx].sg_rgb_bg;
}
- } else if (strcmp(key, "GUISP") == 0) {
+ } else if (strcmp(key, "GUISP") == 0) {
char **const namep = &HL_TABLE()[idx].sg_rgb_sp_name;
if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) {
@@ -7032,9 +7159,9 @@ void do_highlight(const char *line, const bool forceit, const bool init)
if (is_normal_group) {
normal_sp = HL_TABLE()[idx].sg_rgb_sp;
}
- } else if (strcmp(key, "START") == 0 || strcmp(key, "STOP") == 0) {
+ } else if (strcmp(key, "START") == 0 || strcmp(key, "STOP") == 0) {
// Ignored for now
- } else if (strcmp(key, "BLEND") == 0) {
+ } else if (strcmp(key, "BLEND") == 0) {
if (strcmp(arg, "NONE") != 0) {
HL_TABLE()[idx].sg_blend = strtol(arg, NULL, 10);
} else {
@@ -7134,13 +7261,13 @@ void restore_cterm_colors(void)
static int hl_has_settings(int idx, bool check_link)
{
return HL_TABLE()[idx].sg_cleared == 0
- && (HL_TABLE()[idx].sg_attr != 0
- || HL_TABLE()[idx].sg_cterm_fg != 0
- || HL_TABLE()[idx].sg_cterm_bg != 0
- || HL_TABLE()[idx].sg_rgb_fg_name != NULL
- || HL_TABLE()[idx].sg_rgb_bg_name != NULL
- || HL_TABLE()[idx].sg_rgb_sp_name != NULL
- || (check_link && (HL_TABLE()[idx].sg_set & SG_LINK)));
+ && (HL_TABLE()[idx].sg_attr != 0
+ || HL_TABLE()[idx].sg_cterm_fg != 0
+ || HL_TABLE()[idx].sg_cterm_bg != 0
+ || HL_TABLE()[idx].sg_rgb_fg_name != NULL
+ || HL_TABLE()[idx].sg_rgb_bg_name != NULL
+ || HL_TABLE()[idx].sg_rgb_sp_name != NULL
+ || (check_link && (HL_TABLE()[idx].sg_set & SG_LINK)));
}
/*
@@ -7188,18 +7315,18 @@ static void highlight_list_one(const int id)
}
didh = highlight_list_arg(id, didh, LIST_ATTR,
- sgp->sg_cterm, NULL, "cterm");
+ sgp->sg_cterm, NULL, "cterm");
didh = highlight_list_arg(id, didh, LIST_INT,
- sgp->sg_cterm_fg, NULL, "ctermfg");
+ sgp->sg_cterm_fg, NULL, "ctermfg");
didh = highlight_list_arg(id, didh, LIST_INT,
- sgp->sg_cterm_bg, NULL, "ctermbg");
+ sgp->sg_cterm_bg, NULL, "ctermbg");
didh = highlight_list_arg(id, didh, LIST_ATTR,
- sgp->sg_gui, NULL, "gui");
+ sgp->sg_gui, NULL, "gui");
didh = highlight_list_arg(id, didh, LIST_STRING,
- 0, sgp->sg_rgb_fg_name, "guifg");
+ 0, sgp->sg_rgb_fg_name, "guifg");
didh = highlight_list_arg(id, didh, LIST_STRING,
- 0, sgp->sg_rgb_bg_name, "guibg");
+ 0, sgp->sg_rgb_bg_name, "guibg");
didh = highlight_list_arg(id, didh, LIST_STRING,
0, sgp->sg_rgb_sp_name, "guisp");
@@ -7245,9 +7372,8 @@ Dictionary get_global_hl_defs(void)
/// @param type one of \ref LIST_XXX
/// @param iarg integer argument used if \p type == LIST_INT
/// @param sarg string used if \p type == LIST_STRING
-static bool highlight_list_arg(
- const int id, bool didh, const int type, int iarg,
- char *const sarg, const char *const name)
+static bool highlight_list_arg(const int id, bool didh, const int type, int iarg, char *const sarg,
+ const char *const name)
{
char buf[100];
@@ -7264,10 +7390,11 @@ static bool highlight_list_arg(
buf[0] = NUL;
for (int i = 0; hl_attr_table[i] != 0; i++) {
if (iarg & hl_attr_table[i]) {
- if (buf[0] != NUL)
+ if (buf[0] != NUL) {
xstrlcat((char *)buf, ",", 100);
+ }
xstrlcat((char *)buf, hl_name_table[i], 100);
- iarg &= ~hl_attr_table[i]; /* don't want "inverse" */
+ iarg &= ~hl_attr_table[i]; // don't want "inverse"
}
}
}
@@ -7320,8 +7447,7 @@ const char *highlight_has_attr(const int id, const int flag, const int modec)
///
/// @return color name, possibly in a static buffer. Buffer will be overwritten
/// on next highlight_color() call. May return NULL.
-const char *highlight_color(const int id, const char *const what,
- const int modec)
+const char *highlight_color(const int id, const char *const what, const int modec)
FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
{
static char name[20];
@@ -7347,11 +7473,11 @@ const char *highlight_color(const int id, const char *const what,
if (modec == 'g') {
if (what[2] == '#' && ui_rgb_attached()) {
if (fg) {
- n = HL_TABLE()[id - 1].sg_rgb_fg;
+ n = HL_TABLE()[id - 1].sg_rgb_fg;
} else if (sp) {
- n = HL_TABLE()[id - 1].sg_rgb_sp;
+ n = HL_TABLE()[id - 1].sg_rgb_sp;
} else {
- n = HL_TABLE()[id - 1].sg_rgb_bg;
+ n = HL_TABLE()[id - 1].sg_rgb_bg;
}
if (n < 0 || n > 0xffffff) {
return NULL;
@@ -7393,8 +7519,8 @@ const char *highlight_color(const int id, const char *const what,
/// @param id highlight group id
/// @param force_newline always start a new line
/// @return true when started a new line.
-static bool syn_list_header(const bool did_header, const int outlen,
- const int id, bool force_newline)
+static bool syn_list_header(const bool did_header, const int outlen, const int id,
+ bool force_newline)
{
int endcol = 19;
bool newline = true;
@@ -7410,7 +7536,7 @@ static bool syn_list_header(const bool did_header, const int outlen,
} else if ((ui_has(kUIMessages) || msg_silent) && !force_newline) {
msg_putchar(' ');
adjust = false;
- } else if (msg_col + outlen + 1 >= Columns || force_newline) {
+ } else if (msg_col + outlen + 1 >= Columns || force_newline) {
msg_putchar('\n');
if (got_int) {
return true;
@@ -7430,7 +7556,7 @@ static bool syn_list_header(const bool did_header, const int outlen,
msg_advance(endcol);
}
- /* Show "xxx" with the attributes. */
+ // Show "xxx" with the attributes.
if (!did_header) {
msg_puts_attr("xxx", syn_id2attr(id));
msg_putchar(' ');
@@ -7445,7 +7571,7 @@ static bool syn_list_header(const bool did_header, const int outlen,
static void set_hl_attr(int idx)
{
HlAttrs at_en = HLATTRS_INIT;
- struct hl_group *sgp = HL_TABLE() + idx;
+ struct hl_group *sgp = HL_TABLE() + idx;
at_en.cterm_ae_attr = sgp->sg_cterm;
at_en.cterm_fg_color = sgp->sg_cterm_fg;
@@ -7525,8 +7651,9 @@ int highlight_exists(const char_u *name)
*/
char_u *syn_id2name(int id)
{
- if (id <= 0 || id > highlight_ga.ga_len)
+ if (id <= 0 || id > highlight_ga.ga_len) {
return (char_u *)"";
+ }
return HL_TABLE()[id - 1].sg_name;
}
@@ -7554,15 +7681,15 @@ int syn_check_group(const char_u *name, int len)
/// @see syn_check_group syn_unadd_group
static int syn_add_group(char_u *name)
{
- char_u *p;
+ char_u *p;
- /* Check that the name is ASCII letters, digits and underscore. */
+ // Check that the name is ASCII letters, digits and underscore.
for (p = name; *p != NUL; ++p) {
if (!vim_isprintc(*p)) {
EMSG(_("E669: Unprintable character in group name"));
xfree(name);
return 0;
- } else if (!ASCII_ISALNUM(*p) && *p != '_') {
+ } else if (!ASCII_ISALNUM(*p) && *p != '_') {
/* This is an error, but since there previously was no check only
* give a warning. */
msg_source(HL_ATTR(HLF_W));
@@ -7588,7 +7715,7 @@ static int syn_add_group(char_u *name)
char *const name_up = (char *)vim_strsave_up(name);
// Append another syntax_highlight entry.
- struct hl_group* hlgp = GA_APPEND_VIA_PTR(struct hl_group, &highlight_ga);
+ struct hl_group * hlgp = GA_APPEND_VIA_PTR(struct hl_group, &highlight_ga);
memset(hlgp, 0, sizeof(*hlgp));
hlgp->sg_name = name;
hlgp->sg_rgb_bg = -1;
@@ -7640,9 +7767,9 @@ int syn_get_final_id(int hl_id)
{
int count;
- if (hl_id > highlight_ga.ga_len || hl_id < 1)
- return 0; /* Can be called from eval!! */
-
+ if (hl_id > highlight_ga.ga_len || hl_id < 1) {
+ return 0; // Can be called from eval!!
+ }
/*
* Follow links until there is no more.
* Look out for loops! Break after 100 links.
@@ -7690,8 +7817,7 @@ void highlight_attr_set_all(void)
}
// Apply difference between User[1-9] and HLF_S to HLF_SNC.
-static void combine_stl_hlt(int id, int id_S, int id_alt, int hlcnt, int i,
- int hlf, int *table)
+static void combine_stl_hlt(int id, int id_S, int id_alt, int hlcnt, int i, int hlf, int *table)
FUNC_ATTR_NONNULL_ALL
{
struct hl_group *const hlt = HL_TABLE();
@@ -7808,7 +7934,7 @@ void set_context_in_highlight_cmd(expand_T *xp, const char *arg)
include_link = 2;
include_default = 1;
- /* (part of) subcommand already typed */
+ // (part of) subcommand already typed
if (*arg != NUL) {
const char *p = (const char *)skiptowhite((const char_u *)arg);
if (*p != NUL) { // Past "default" or group name.
@@ -7818,7 +7944,7 @@ void set_context_in_highlight_cmd(expand_T *xp, const char *arg)
xp->xp_pattern = (char_u *)arg;
p = (const char *)skiptowhite((const char_u *)arg);
}
- if (*p != NUL) { /* past group name */
+ if (*p != NUL) { // past group name
include_link = 0;
if (arg[1] == 'i' && arg[0] == 'N') {
highlight_list();
@@ -8597,7 +8723,6 @@ color_name_table_T color_name_table[] = {
/// return the hex value or -1 if could not find a correct value
RgbValue name_to_color(const char *name)
{
-
if (name[0] == '#' && isxdigit(name[1]) && isxdigit(name[2])
&& isxdigit(name[3]) && isxdigit(name[4]) && isxdigit(name[5])
&& isxdigit(name[6]) && name[7] == NUL) {
@@ -8620,5 +8745,5 @@ RgbValue name_to_color(const char *name)
/**************************************
-* End of Highlighting stuff *
+* End of Highlighting stuff *
**************************************/
diff --git a/src/nvim/testdir/test_ins_complete.vim b/src/nvim/testdir/test_ins_complete.vim
index 0fb026f6b0..ce75799551 100644
--- a/src/nvim/testdir/test_ins_complete.vim
+++ b/src/nvim/testdir/test_ins_complete.vim
@@ -497,6 +497,133 @@ func Test_ins_compl_tag_sft()
%bwipe!
endfunc
+" Test for completing special characters
+func Test_complete_special_chars()
+ new
+ call setline(1, 'int .*[-\^$ func float')
+ call feedkeys("oin\<C-X>\<C-P>\<C-X>\<C-P>\<C-X>\<C-P>", 'xt')
+ call assert_equal('int .*[-\^$ func float', getline(2))
+ close!
+endfunc
+
+" Test for completion when text is wrapped across lines.
+func Test_complete_across_line()
+ new
+ call setline(1, ['red green blue', 'one two three'])
+ setlocal textwidth=20
+ exe "normal 2G$a re\<C-X>\<C-P>\<C-X>\<C-P>\<C-X>\<C-P>\<C-X>\<C-P>"
+ call assert_equal(['one two three red', 'green blue one'], getline(2, '$'))
+ close!
+endfunc
+
+" Test for using CTRL-L to add one character when completing matching
+func Test_complete_add_onechar()
+ new
+ call setline(1, ['wool', 'woodwork'])
+ call feedkeys("Gowoo\<C-P>\<C-P>\<C-P>\<C-L>f", 'xt')
+ call assert_equal('woof', getline(3))
+
+ " use 'ignorecase' and backspace to erase characters from the prefix string
+ " and then add letters using CTRL-L
+ %d
+ set ignorecase backspace=2
+ setlocal complete=.
+ call setline(1, ['workhorse', 'workload'])
+ normal Go
+ exe "normal aWOR\<C-P>\<bs>\<bs>\<bs>\<bs>\<bs>\<bs>\<C-L>r\<C-L>\<C-L>"
+ call assert_equal('workh', getline(3))
+ set ignorecase& backspace&
+ close!
+endfunc
+
+" Test insert completion with 'cindent' (adjust the indent)
+func Test_complete_with_cindent()
+ new
+ setlocal cindent
+ call setline(1, ['if (i == 1)', " j = 2;"])
+ exe "normal Go{\<CR>i\<C-X>\<C-L>\<C-X>\<C-L>\<CR>}"
+ call assert_equal(['{', "\tif (i == 1)", "\t\tj = 2;", '}'], getline(3, '$'))
+
+ %d
+ call setline(1, ['when while', '{', ''])
+ setlocal cinkeys+==while
+ exe "normal Giwh\<C-P> "
+ call assert_equal("\twhile ", getline('$'))
+ close!
+endfunc
+
+" Test for <CTRL-X> <CTRL-V> completion. Complete commands and functions
+func Test_complete_cmdline()
+ new
+ exe "normal icaddb\<C-X>\<C-V>"
+ call assert_equal('caddbuffer', getline(1))
+ exe "normal ocall getqf\<C-X>\<C-V>"
+ call assert_equal('call getqflist(', getline(2))
+ exe "normal oabcxyz(\<C-X>\<C-V>"
+ call assert_equal('abcxyz(', getline(3))
+ com! -buffer TestCommand1 echo 'TestCommand1'
+ com! -buffer TestCommand2 echo 'TestCommand2'
+ write TestCommand1Test
+ write TestCommand2Test
+ " Test repeating <CTRL-X> <CTRL-V> and switching to another CTRL-X mode
+ exe "normal oT\<C-X>\<C-V>\<C-X>\<C-V>\<C-X>\<C-F>\<Esc>"
+ call assert_equal('TestCommand2Test', getline(4))
+ call delete('TestCommand1Test')
+ call delete('TestCommand2Test')
+ delcom TestCommand1
+ delcom TestCommand2
+ close!
+endfunc
+
+" Test for <CTRL-X> <CTRL-Z> stopping completion without changing the match
+func Test_complete_stop()
+ new
+ func Save_mode1()
+ let g:mode1 = mode(1)
+ return ''
+ endfunc
+ func Save_mode2()
+ let g:mode2 = mode(1)
+ return ''
+ endfunc
+ inoremap <F1> <C-R>=Save_mode1()<CR>
+ inoremap <F2> <C-R>=Save_mode2()<CR>
+ call setline(1, ['aaa bbb ccc '])
+ exe "normal A\<C-N>\<C-P>\<F1>\<C-X>\<C-Z>\<F2>\<Esc>"
+ call assert_equal('ic', g:mode1)
+ call assert_equal('i', g:mode2)
+ call assert_equal('aaa bbb ccc ', getline(1))
+ exe "normal A\<C-N>\<Down>\<F1>\<C-X>\<C-Z>\<F2>\<Esc>"
+ call assert_equal('ic', g:mode1)
+ call assert_equal('i', g:mode2)
+ call assert_equal('aaa bbb ccc aaa', getline(1))
+ set completeopt+=noselect
+ exe "normal A \<C-N>\<Down>\<Down>\<C-L>\<C-L>\<F1>\<C-X>\<C-Z>\<F2>\<Esc>"
+ call assert_equal('ic', g:mode1)
+ call assert_equal('i', g:mode2)
+ call assert_equal('aaa bbb ccc aaa bb', getline(1))
+ set completeopt&
+ exe "normal A d\<C-N>\<F1>\<C-X>\<C-Z>\<F2>\<Esc>"
+ call assert_equal('ic', g:mode1)
+ call assert_equal('i', g:mode2)
+ call assert_equal('aaa bbb ccc aaa bb d', getline(1))
+ com! -buffer TestCommand1 echo 'TestCommand1'
+ com! -buffer TestCommand2 echo 'TestCommand2'
+ exe "normal oT\<C-X>\<C-V>\<C-X>\<C-V>\<F1>\<C-X>\<C-Z>\<F2>\<Esc>"
+ call assert_equal('ic', g:mode1)
+ call assert_equal('i', g:mode2)
+ call assert_equal('TestCommand2', getline(2))
+ delcom TestCommand1
+ delcom TestCommand2
+ unlet g:mode1
+ unlet g:mode2
+ iunmap <F1>
+ iunmap <F2>
+ delfunc Save_mode1
+ delfunc Save_mode2
+ close!
+endfunc
+
" Test to ensure 'Scanning...' messages are not recorded in messages history
func Test_z1_complete_no_history()
new
diff --git a/src/nvim/window.c b/src/nvim/window.c
index cb4be36d36..42fe2c0f49 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -840,14 +840,15 @@ void ui_ext_win_viewport(win_T *wp)
{
if ((wp == curwin || ui_has(kUIMultigrid)) && wp->w_viewport_invalid) {
int botline = wp->w_botline;
- if (botline == wp->w_buffer->b_ml.ml_line_count+1
- && wp->w_empty_rows == 0) {
+ int line_count = wp->w_buffer->b_ml.ml_line_count;
+ if (botline == line_count+1 && wp->w_empty_rows == 0) {
// TODO(bfredl): The might be more cases to consider, like how does this
// interact with incomplete final line? Diff filler lines?
botline = wp->w_buffer->b_ml.ml_line_count;
}
ui_call_win_viewport(wp->w_grid_alloc.handle, wp->handle, wp->w_topline-1,
- botline, wp->w_cursor.lnum-1, wp->w_cursor.col);
+ botline, wp->w_cursor.lnum-1, wp->w_cursor.col,
+ line_count);
wp->w_viewport_invalid = false;
}
}
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua
index 59ce7c82e2..ad97af9535 100644
--- a/test/functional/ui/float_spec.lua
+++ b/test/functional/ui/float_spec.lua
@@ -782,8 +782,8 @@ describe('float window', function()
]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 2, 5, true }
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2};
}}
else
screen:expect{grid=[[
@@ -825,8 +825,8 @@ describe('float window', function()
]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 2, 5, true }
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2};
}}
else
screen:expect{grid=[[
@@ -868,8 +868,8 @@ describe('float window', function()
]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 2, 5, true }
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2};
}}
else
screen:expect{grid=[[
@@ -911,8 +911,8 @@ describe('float window', function()
]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 2, 5, true }
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2};
}}
else
screen:expect{grid=[[
@@ -955,8 +955,8 @@ describe('float window', function()
]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 2, 5, true }
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2};
}}
else
screen:expect{grid=[[
@@ -996,8 +996,8 @@ describe('float window', function()
]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 2, 5, true }
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2};
}}
else
screen:expect{grid=[[
@@ -1037,8 +1037,8 @@ describe('float window', function()
]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 2, 5, true }
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2};
}}
else
screen:expect{grid=[[
@@ -1087,8 +1087,8 @@ describe('float window', function()
]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 2, 5, true }
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 6, curline = 5, curcol = 0};
- [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 6, curline = 5, curcol = 0, linecount = 6};
+ [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2};
}}
else
screen:expect{grid=[[
@@ -1138,8 +1138,8 @@ describe('float window', function()
]], float_pos={
[4] = { { id = 1001 }, "NW", 1, 0, 0, true }
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
}}
else
screen:expect{grid=[[
@@ -1196,8 +1196,8 @@ describe('float window', function()
]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 0, 5, true }
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 0, linecount = 3};
}}
else
screen:expect{grid=[[
@@ -1255,8 +1255,8 @@ describe('float window', function()
[5] = { { id = 1002 }, "NW", 1, 0, 5, true, 50 },
[6] = { { id = -1 }, "NW", 5, 4, 0, false, 100 }
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 3};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1};
+ [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 3, linecount=3};
}}
else
screen:expect{grid=[[
@@ -1705,6 +1705,7 @@ describe('float window', function()
botline = 3,
curline = 0,
curcol = 3,
+ linecount = 2,
win = { id = 1000 }
},
[4] = {
@@ -1712,6 +1713,7 @@ describe('float window', function()
botline = 3,
curline = 0,
curcol = 3,
+ linecount = 2,
win = { id = 1001 }
},
[5] = {
@@ -1719,6 +1721,7 @@ describe('float window', function()
botline = 2,
curline = 0,
curcol = 0,
+ linecount = 1,
win = { id = 1002 }
}
}}
@@ -6339,8 +6342,8 @@ describe('float window', function()
]], float_pos={
[4] = { { id = 1001 }, "NW", 1, 2, 5, true };
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
}}
else
screen:expect{grid=[[
@@ -6396,10 +6399,10 @@ describe('float window', function()
[5] = { { id = 1002 }, "NW", 1, 3, 8, true };
[6] = { { id = 1003 }, "NW", 1, 4, 10, true };
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1};
+ [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1};
+ [6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1};
}}
else
screen:expect{grid=[[
@@ -6444,8 +6447,8 @@ describe('float window', function()
]], float_pos={
[4] = { { id = 1001 }, "NW", 1, 2, 5, true };
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
}}
else
screen:expect{grid=[[
@@ -6501,10 +6504,10 @@ describe('float window', function()
[5] = { { id = 1002 }, "NW", 1, 4, 10, true };
[6] = { { id = 1003 }, "NW", 1, 3, 8, true };
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
}}
else
screen:expect{grid=[[
@@ -6564,10 +6567,10 @@ describe('float window', function()
[5] = {{id = 1002}, "NW", 1, 2, 6, true, 50};
[6] = {{id = 1003}, "NW", 1, 3, 7, true, 40};
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
}}
else
screen:expect{grid=[[
diff --git a/test/functional/ui/multigrid_spec.lua b/test/functional/ui/multigrid_spec.lua
index fdf8e66e4f..4e5e9c3a71 100644
--- a/test/functional/ui/multigrid_spec.lua
+++ b/test/functional/ui/multigrid_spec.lua
@@ -2117,7 +2117,7 @@ describe('ext_multigrid', function()
## grid 3
|
]], win_viewport={
- [2] = {win = { id = 1000 }, topline = 0, botline = 2, curline = 0, curcol = 0}
+ [2] = {win = { id = 1000 }, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}
}}
insert([[
Lorem ipsum dolor sit amet, consectetur
@@ -2152,7 +2152,7 @@ describe('ext_multigrid', function()
## grid 3
|
]], win_viewport={
- [2] = {win = {id = 1000}, topline = 5, botline = 11, curline = 10, curcol = 7},
+ [2] = {win = {id = 1000}, topline = 5, botline = 11, curline = 10, curcol = 7, linecount = 11},
}}
@@ -2177,7 +2177,7 @@ describe('ext_multigrid', function()
## grid 3
|
]], win_viewport={
- [2] = {win = {id = 1000}, topline = 2, botline = 9, curline = 7, curcol = 0},
+ [2] = {win = {id = 1000}, topline = 2, botline = 9, curline = 7, curcol = 0, linecount = 11},
}}
command("split")
@@ -2201,8 +2201,8 @@ describe('ext_multigrid', function()
reprehenderit in voluptate velit esse cillum |
^dolore eu fugiat nulla pariatur. Excepteur sint |
]], win_viewport={
- [2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0},
- [4] = {win = {id = 1001}, topline = 5, botline = 9, curline = 7, curcol = 0},
+ [2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0, linecount = 11},
+ [4] = {win = {id = 1001}, topline = 5, botline = 9, curline = 7, curcol = 0, linecount = 11},
}}
feed("b")
@@ -2226,8 +2226,8 @@ describe('ext_multigrid', function()
reprehenderit in voluptate velit esse ^cillum |
dolore eu fugiat nulla pariatur. Excepteur sint |
]], win_viewport={
- [2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0},
- [4] = {win = {id = 1001}, topline = 5, botline = 9, curline = 6, curcol = 38},
+ [2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0, linecount = 11},
+ [4] = {win = {id = 1001}, topline = 5, botline = 9, curline = 6, curcol = 38, linecount = 11},
}}
feed("2k")
@@ -2251,8 +2251,8 @@ describe('ext_multigrid', function()
ea commodo consequat. Duis aute irure dolor in |
reprehenderit in voluptate velit esse cillum |
]], win_viewport={
- [2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0},
- [4] = {win = {id = 1001}, topline = 4, botline = 8, curline = 4, curcol = 38},
+ [2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0, linecount = 11},
+ [4] = {win = {id = 1001}, topline = 4, botline = 8, curline = 4, curcol = 38, linecount = 11},
}}
-- handles non-current window
@@ -2277,8 +2277,8 @@ describe('ext_multigrid', function()
ea commodo consequat. Duis aute irure dolor in |
reprehenderit in voluptate velit esse cillum |
]], win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 10},
- [4] = {win = {id = 1001}, topline = 4, botline = 8, curline = 4, curcol = 38},
+ [2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 10, linecount = 11},
+ [4] = {win = {id = 1001}, topline = 4, botline = 8, curline = 4, curcol = 38, linecount = 11},
}}
end)
@@ -2304,7 +2304,7 @@ describe('ext_multigrid', function()
## grid 3
|
]], win_viewport={
- [2] = {win = { id = 1000 }, topline = 0, botline = 2, curline = 0, curcol = 0}
+ [2] = {win = { id = 1000 }, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}
}}
insert([[
Lorem ipsum dolor sit amet, consectetur
@@ -2339,7 +2339,7 @@ describe('ext_multigrid', function()
## grid 3
|
]], win_viewport={
- [2] = {win = {id = 1000}, topline = 5, botline = 11, curline = 10, curcol = 7},
+ [2] = {win = {id = 1000}, topline = 5, botline = 11, curline = 10, curcol = 7, linecount = 11},
}}
meths.input_mouse('left', 'press', '', 1,5, 1)
@@ -2366,7 +2366,7 @@ describe('ext_multigrid', function()
## grid 3
{7:-- VISUAL --} |
]], win_viewport={
- [2] = {win = {id = 1000}, topline = 6, botline = 12, curline = 10, curcol = 1},
+ [2] = {win = {id = 1000}, topline = 6, botline = 12, curline = 10, curcol = 1, linecount = 11},
}}
end)
end)
diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua
index f73d051857..61f19c3794 100644
--- a/test/functional/ui/screen.lua
+++ b/test/functional/ui/screen.lua
@@ -773,13 +773,14 @@ function Screen:_handle_win_pos(grid, win, startrow, startcol, width, height)
self.float_pos[grid] = nil
end
-function Screen:_handle_win_viewport(grid, win, topline, botline, curline, curcol)
+function Screen:_handle_win_viewport(grid, win, topline, botline, curline, curcol, linecount)
self.win_viewport[grid] = {
win = win,
topline = topline,
botline = botline,
curline = curline,
- curcol = curcol
+ curcol = curcol,
+ linecount = linecount
}
end
@@ -1306,7 +1307,7 @@ local function fmt_ext_state(name, state)
for k,v in pairs(state) do
str = (str.." ["..k.."] = {win = {id = "..v.win.id.."}, topline = "
..v.topline..", botline = "..v.botline..", curline = "..v.curline
- ..", curcol = "..v.curcol.."};\n")
+ ..", curcol = "..v.curcol..", linecount = "..v.linecount.."};\n")
end
return str .. "}"
elseif name == "float_pos" then