Commit Graph

25448 Commits

Author SHA1 Message Date
Christian Clason
4d04feb662
feat(lua): vim.tbl_contains supports general tables and predicates (#23040)
* feat(lua): vim.tbl_contains supports general tables and predicates

Problem: `vim.tbl_contains` only works for list-like tables (integer
keys without gaps) and primitive values (in particular, not for nested
tables).

Solution: Rename `vim.tbl_contains` to `vim.list_contains` and add new
`vim.tbl_contains` that works for general tables and optionally allows
`value` to be a predicate function that is checked for every key.
2023-04-14 10:39:57 +02:00
zeertzjq
72a327cad2
Merge pull request #23081 from zeertzjq/vim-8.2.1062
vim-patch:8.2.{1062,1063,1064,1065,1068,1069,1070,1071,1073,1074,1075,1076,1079,1080,1098,1099,1100,1125,1161,1162,1163,1203,3216}
2023-04-14 16:33:37 +08:00
zeertzjq
9c66b48316 vim-patch:8.2.3216: Vim9: crash when using variable in a loop at script level
Problem:    Vim9: crash when using variable in a loop at script level.
Solution:   Do not clear the variable if a function was defined.
            Do not create a new entry in sn_var_vals every time.
            (closes vim/vim#8628)

2eb6fc3b52

Omit eval_cstack: Vim9 script only.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-14 16:10:10 +08:00
zeertzjq
56cfecdd59 vim-patch:8.2.1203: unused assignments in expression evaluation
Problem:    Unused assignments in expression evaluation.
Solution:   Move declarations and assignments to inner blocks where possible.

3ac9c4701a

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-14 16:10:10 +08:00
zeertzjq
c804c7df0c vim-patch:8.2.1162: crash when using a lambda
Problem:    Crash when using a lambda.
Solution:   Check for evalarg to be NULL.

efaaaa683b

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-14 16:10:10 +08:00
zeertzjq
cc7a50a9ae vim-patch:8.2.1161: Vim9: using freed memory
Problem:    Vim9: using freed memory.
Solution:   Put pointer back in evalarg instead of freeing it.

8e2730a315

Omit eval_tofree_lambda: Vim9 script only.

N/A patches for version.c:

vim-patch:8.2.1163: build error

Problem:    Build error.
Solution:   Add missing change to globals.

6e13530ca0

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-14 16:10:09 +08:00
zeertzjq
562840a2a1 vim-patch:8.2.1125: Vim9: double quote can be a string or a comment
Problem:    Vim9: double quote can be a string or a comment.
Solution:   Only support comments starting with # to avoid confusion.

962d721319

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-14 16:10:09 +08:00
zeertzjq
cf37630d1b vim-patch:8.2.1110: Vim9: line continuation does not work in function arguments
Problem:    Vim9: line continuation does not work in function arguments.
Solution:   Pass "evalarg" to get_func_tv().  Fix seeing double quoted string
            as comment.

e6b5324e3a

Omit skipwhite_and_linebreak_keep_string(): Vim9 script only.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-14 16:10:09 +08:00
zeertzjq
9c65a18753 vim-patch:8.2.1103: Coverity reports an unnecessary NULL check
Problem:    Coverity reports an unnecessary NULL check.
Solution:   Remove the check for NULL.

e707c882b2

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-14 16:10:09 +08:00
zeertzjq
04b58cec86 vim-patch:8.2.1100: Vim9: cannot use line break in :execute argument
Problem:    Vim9: cannot use line break in :execute, :echomsg and :echoerr
            argument.
Solution:   Check for line break.

47e880d6c1

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-14 16:10:09 +08:00
zeertzjq
78dd6100b1 vim-patch:8.2.1099: Vim9: cannot use line break in :cexpr argument
Problem:    Vim9: cannot use line break in :cexpr argument.
Solution:   Check for line break.

37c8371195

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-14 16:10:09 +08:00
zeertzjq
ff963d699b vim-patch:8.2.1098: Vim9: cannot use line break in :throw argument
Problem:    Vim9: cannot use line break in :throw argument.
Solution:   Check for line break.

006ad48b8a

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-14 16:10:09 +08:00
zeertzjq
8729c41f44 vim-patch:8.2.1080: Vim9: no line break allowed in a for loop
Problem:    Vim9: no line break allowed in a for loop.
Solution:   Skip line breaks in for command.

b7a78f7a67

Omit *_break_count and skip_for_lines(): Vim9 script only.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-14 16:10:09 +08:00
zeertzjq
4b84b2e2aa vim-patch:8.2.1079: Vim9: no line break allowed in a while loop
Problem:    Vim9: no line break allowed in a while loop.
Solution:   Update stored loop lines when finding line breaks.

d5053d015a

Omit getline_peek(): Vim9 script only.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-14 16:10:09 +08:00
zeertzjq
e99f28e57d vim-patch:8.2.1076: Vim9: no line break allowed in :if expression
Problem:    Vim9: no line break allowed in :if expression.
Solution:   Skip linebreak.

faf8626b79

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-14 16:10:09 +08:00
zeertzjq
64a91f5ea2 vim-patch:8.2.1075: Vim9: no line break allowed in :echo expression
Problem:    Vim9: no line break allowed in :echo expression.
Solution:   Skip linebreak.

7e8967fdcd

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-14 16:10:09 +08:00
zeertzjq
10b8c6481f vim-patch:8.2.1074: Vim9: no line break allowed after some operators
Problem:    Vim9: no line break allowed after some operators.
Solution:   Skip a line break after the operator.  Add
            eval_may_get_next_line() to simplify checking for a line break.

9215f01218

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-14 16:10:09 +08:00
zeertzjq
9c29c07705 vim-patch:8.2.1073: Vim9: no line break allowed in () expression
Problem:    Vim9: no line break allowed in () expression.
Solution:   Skip a line break.

7a4981b936

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-14 16:10:09 +08:00
zeertzjq
d927128fcc vim-patch:8.2.1071: Vim9: no line break allowed inside a lambda
Problem:    Vim9: no line break allowed inside a lambda.
Solution:   Handle line break inside a lambda in Vim9 script.

e40fbc2ca9

Omit skip_expr_concatenate(). Apply the change to skip_expr() instead.
Omit eval_ga: Vim9 script only.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-14 16:10:09 +08:00
zeertzjq
89ff05b258 vim-patch:8.2.1069: Vim9: fail to check for white space in list
Problem:    Vim9: fail to check for white space in list.
Solution:   Add check for white space.

e6e031739c

N/A patches for version.c:

vim-patch:8.2.1070: Vim9: leaking memory when lacking white space in dict

Problem:    Vim9: leaking memory when lacking white space in dict.
Solution:   Clear the typval.

ab19d495fd

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-14 16:10:09 +08:00
zeertzjq
4ce20f7229 vim-patch:8.2.1068: Vim9: no line break allowed inside a dict
Problem:    Vim9: no line break allowed inside a dict.
Solution:   Handle line break inside a dict in Vim9 script.

8ea9390b78

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-14 16:10:09 +08:00
zeertzjq
2af6bbcfa7 vim-patch:8.2.1065: Vim9: no line break allowed inside a list
Problem:    Vim9: no line break allowed inside a list.
Solution:   Handle line break inside a list in Vim9 script.

7147820cb9

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-14 16:10:09 +08:00
zeertzjq
51f99a347d vim-patch:8.2.1064: Vim9: no line break allowed before comperators
Problem:    Vim9: no line break allowed before comperators.
Solution:   Check for comperator after line break.

e6536aa766

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-14 16:10:09 +08:00
zeertzjq
9781a21133 vim-patch:8.2.1063: Vim9: no line break allowed before || or &&
Problem:    Vim9: no line break allowed before || or &&.
Solution:   Check for operator after line break.

be7ee48876

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-14 16:10:09 +08:00
zeertzjq
9ecfb42ec0 vim-patch:8.2.1062: Vim9: no line break allowed inside "cond ? val1 : val2"
Problem:    Vim9: no line break allowed inside "cond ? val1 : val2".
Solution:   Check for operator after line break.

793648fb56

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-14 16:10:08 +08:00
zeertzjq
37bb40701d
Merge pull request #23078 from zeertzjq/vim-8.2.1047
vim-patch:8.2.{1047,1048,1049,1050,1052},9.0.1447
2023-04-14 10:58:29 +08:00
zeertzjq
e8c25aac8d vim-patch:9.0.1447: condition is always true
Problem:    Condition is always true.
Solution:   Remove the useless condition. (closes vim/vim#12253)

474891bc89
2023-04-14 10:30:21 +08:00
zeertzjq
8e2903d2fe vim-patch:8.2.1049: Vim9: leaking memory when using continuation line
Problem:    Vim9: leaking memory when using continuation line.
Solution:   Keep a pointer to the continuation line in evalarg_T.  Centralize
            checking for a next command.

b171fb1790

Omit eval_next_line(): Vim9 script only.

vim-patch:8.2.1050: missing change in struct

Problem:    Missing change in struct.
Solution:   Add missing change.

65a8ed37f7

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-14 09:42:59 +08:00
zeertzjq
bd83b587b1 vim-patch:8.2.1047: Vim9: script cannot use line continuation like :def function
Problem:    Vim9: script cannot use line continuation like in a :def function.
Solution:   Pass the getline function pointer to the eval() functions.  Use it
            for addition and multiplication operators.

5409f5d8c9

Omit source_nextline() and eval_next_non_blank(): Vim9 script only.

N/A patches for version.c:

vim-patch:8.2.1048: build failure without the eval feature

Problem:    Build failure without the eval feature.
Solution:   Add dummy typedef.

9d40c63c7d

vim-patch:8.2.1052: build failure with older compilers

Problem:    Build failure with older compilers.
Solution:   Move declaration to start of block.

7acde51832

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-14 09:23:40 +08:00
zeertzjq
f64f6706e5
vim-patch:9.0.1449: test for prompt buffer is flaky (#23076)
Problem:    Test for prompt buffer is flaky.
Solution:   Use WaitForAssert() instead of TermWait(). (Ozaki Kiichi,
            closes vim/vim#12247)

ff6c230051
2023-04-14 07:12:42 +08:00
zeertzjq
8f69c5ed45
vim-patch:8.2.{0695,0725,0734,0753,0818,0819,0822} (#23075)
vim-patch:8.2.0695: Vim9: cannot define a function inside a function

Problem:    Vim9: cannot define a function inside a function.
Solution:   Initial support for :def inside :def.

04b1269783

vim-patch:8.2.0725: Vim9: cannot call a function declared later in Vim9 script

Problem:    Vim9: cannot call a function declared later in Vim9 script.
Solution:   Make two passes through the script file.

09689a0284

vim-patch:8.2.0734: Vim9: leaking memory when using :finish

Problem:    Vim9: leaking memory when using :finish.
Solution:   Do not check for next line in third pass.

04816717df

vim-patch:8.2.0753: Vim9: expressions are evaluated in the discovery phase

Problem:    Vim9: expressions are evaluated in the discovery phase.
Solution:   Bail out if an expression is not a constant.  Require a type for
            declared constants.

32e351179e

vim-patch:8.2.0818: Vim9: using a discovery phase doesn't work well

Problem:    Vim9: using a discovery phase doesn't work well.
Solution:   Remove the discovery phase, instead compile a function only when
            it is used.  Add :defcompile to compile def functions earlier.

822ba24743

vim-patch:8.2.0819: compiler warning for unused variable

Problem:    Compiler warning for unused variable.
Solution:   Remove the variable.

f40e51a880

vim-patch:8.2.0822: Vim9: code left over from discovery phase

Problem:    Vim9: code left over from discovery phase.
Solution:   Remove the dead code.

2eec37926d

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-14 07:11:59 +08:00
zeertzjq
0adb9f75c5
Merge pull request #23071 from luukvbaal/sloclater
fix: winbar is not redrawn on window change when 'showcmdloc' is "statusline"
2023-04-14 07:00:04 +08:00
quintik
80f6d55521 test(winbar_spec): properly update winbar when 'showcmdloc' is "statusline"
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Luuk van Baal <luukvbaal@gmail.com>
2023-04-14 00:11:28 +02:00
dundargoc
3a3ec37260
test: remove penlight usage 2023-04-14 00:09:56 +02:00
Gregory Anders
bfb28b62da
refactor: remove modelines from Lua files
Now that we have builtin EditorConfig support and a formatting check in
CI, these are not necessary.
2023-04-13 23:29:13 +02:00
Luuk van Baal
086088ce44 vim-patch:9.0.1451: unnecessary redrawing when 'showcmdloc' is not "last"
Problem:    Unnecessary redrawing when 'showcmdloc' is not "last".
Solution:   Redraw later when "showcmd_is_clear" is set. (Luuk van Baal,
            closes vim/vim#12260)

aa7f25ebf1
2023-04-13 23:10:14 +02:00
Lewis Russell
66c66d8db8
fix(loader): reset hashes when running the loader 2023-04-13 17:34:47 +01:00
bfredl
b85ac89326
Merge pull request #23064 from bfredl/nolink
fix(api): make nvim_get_hl not return non-existing groups
2023-04-13 14:39:12 +02:00
bfredl
d05d63a18f fix(api): make nvim_get_hl not return non-existing groups
fixes #23063
2023-04-13 14:17:12 +02:00
zeertzjq
c8c7912a4d
build(vim-patch.sh): ignore test_behave.vim (#23062) 2023-04-13 19:07:42 +08:00
bfredl
231e1988ed
Merge pull request #23054 from bfredl/nobehave
feat(ex_cmds)!: remove :behave
2023-04-13 12:39:05 +02:00
bfredl
e4a136f713 feat(ex_cmds)!: remove :behave
just use the individual options instead.

   set selection=exclusive
   set selectmode=mouse,key
   set mousemodel=popup
   set keymodel=startsel,stopsel
2023-04-13 12:15:30 +02:00
zeertzjq
99c1010aa7
vim-patch:partial:9.0.0364: clang static analyzer gives warnings (#23059)
Problem:    Clang static analyzer gives warnings.
Solution:   Avoid the warnings. (Yegappan Lakshmanan, closes vim/vim#11043)

c99e182e1f

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-04-13 13:27:50 +08:00
dundargoc
5ccec143d8
refactor: remove bugreport.vim
We already have :checkhealth that essentially supersedes it with more
useful error checking.
2023-04-12 23:38:56 +02:00
dundargoc
5a7280ba68
build: create helper function for simplifying luarocks installation
The function keeps track of the previously installed rock, meaning we no
longer need to manually keep track of the dependency chain. This will
make adding or removing rocks much easier.
2023-04-12 21:26:06 +02:00
zeertzjq
23e9d625cf
vim-patch:9.0.1444: crash when passing NULL to setcmdline() (#23048)
Problem:    Crash when passing NULL to setcmdline(). (Andreas Louv)
Solution:   Use tv_get_string() instead of using v_string directly.
            (closes vim/vim#12231, closes vim/vim#12227)

ac6cd31afc
2023-04-12 23:51:43 +08:00
luukvbaal
cdc028e97d
fix(column): add truncated width during estimation for 'statuscolumn'
Problem:    Estimated 'statuscolumn' width estimated is not properly used,
            executing the `w_redr_statuscol` path unnecessarily.
Solution:   Adjust `w_nrwidth` and 'statuscolumn' width before anything
            is actually drawn in a `win_update()`.
2023-04-12 16:40:58 +01:00
zeertzjq
1013aba462
docs: add vim.lsp.buf.formatting_sync() to deprecated.txt (#23045) 2023-04-12 22:52:06 +08:00
Mathias Fußenegger
37011bc45e
fix(diagnostic): rename buffer → bufnr in type annotation (#23042)
See `:h diagnostic-structure`, the property name is `bufnr`, not
`buffer`.
2023-04-12 15:16:15 +02:00
Christian Clason
f5231d61a5
fix(runtime): add commentstring for C# ftplugin (#23039)
Problem: No commentstring is set for C# buffers after removing the
default C-style commentstring

Solution: Add `ftplugin/cs.lua` with C-style commentstring
2023-04-12 13:59:11 +02:00