Commit Graph

5473 Commits

Author SHA1 Message Date
luukvbaal
84a4319545
fix(mouse): cmdline click registered as statuscolumn (#23163) 2023-04-18 08:00:49 +08:00
Gregory Anders
ab1edecfb7
feat(lua): add vim.iter (#23029)
vim.iter wraps a table or iterator function into an `Iter` object with
methods such as `filter`, `map`, and `fold` which can be chained to
produce iterator pipelines that do not create new tables at each step.
2023-04-17 12:54:19 -06:00
Jon Huhn
6cc76011ca
fix(watchfiles): skip Created events when poll starts (#23139) 2023-04-17 18:50:05 +02:00
zeertzjq
9e5f9c25d9
vim-patch:9.0.1460: insufficient testing for getcmdcompltype() (#23159)
Problem:    Insufficient testing for getcmdcompltype().
Solution:   Add a few more test cases. (closes vim/vim#12268)

961b2e54bd
2023-04-17 23:27:04 +08:00
Isak Samsten
07b60efd80
feat(diagnostic): specify diagnostic virtual text prefix as a function
- vim.diagnostic.config() now accepts a function for the virtual_text.prefix
  option, which allows for rendering e.g., diagnostic severities differently.
2023-04-17 12:53:34 +01:00
zeertzjq
75d9c413d4
fix(excmd): make :def unknown rather than unimplemented (#23150) 2023-04-17 17:44:08 +08:00
zeertzjq
7a3f86481e vim-patch:9.0.0419: the :defer command does not check the function arguments
Problem:    The :defer command does not check the function argument count and
            types.
Solution:   Check the function arguments when adding a deferred function.

169003289f

Cherry-pick check_internal_func() from Vim, but use EvalFuncDef pointer
as first argument.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-17 09:38:09 +08:00
zeertzjq
6bfba3660c vim-patch:9.0.0406: deferred functions not invoked when partial func exits
Problem:    Deferred functions not invoked when partial func exits.
Solution:   Create a funccall_T when calling a :def function.

9667b2c888

The remove_funccal() function is currently unused, but it will be used
in patch 9.0.0618.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-17 09:08:08 +08:00
zeertzjq
88c3d89001
vim-patch:9.0.1143: invalid memory access with bad 'statusline' value (#23133)
Problem:    Invalid memory access with bad 'statusline' value.
Solution:   Avoid going over the NUL at the end.

7b17eb4b06

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-16 19:21:06 +08:00
zeertzjq
227f06b7df
vim-patch:9.0.1145: invalid memory access with recursive substitute expression (#23132)
Problem:    Invalid memory access with recursive substitute expression.
Solution:   Check the return value of vim_regsub().

3ac1d97a1d

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-16 18:43:15 +08:00
zeertzjq
fd68cd1c0a
vim-patch:8.2.2857: Vim9: exception in ISN_INSTR caught at wrong level (#23131)
Problem:    Vim9: exception in ISN_INSTR caught at wrong level.
Solution:   Set the starting trylevel in exec_instructions(). (closes vim/vim#8214)

ff65288aa8

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-16 18:27:33 +08:00
Raphael
2f779b94e7
fix(lua): inspect_pos respect bufnr when get syntax info (#23098) 2023-04-16 17:50:32 +08:00
zeertzjq
6ca4fba97f
test(old): sync test_filetype.vim with upstream (#23127) 2023-04-16 17:44:30 +08:00
zeertzjq
b28683d252
vim-patch:9.0.0947: invalid memory access in substitute with function (#23126)
Problem:    Invalid memory access in substitute with function that goes to
            another file.
Solution:   Check for text locked in CTRL-W gf.

cc762a48d4

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-16 17:44:14 +08:00
zeertzjq
c54592bfda
vim-patch:9.0.0621: filetype test leaves file behind (#23125)
Problem:    Filetype test leaves file behind.
Solution:   Add deferred delete flag to writefile(). (Dominique Pellé,
            closes vim/vim#11249)

fc06cda837

Co-authored-by: Dominique Pelle <dominique.pelle@gmail.com>
2023-04-16 17:06:47 +08:00
Christian Clason
d9e9dc3a06
vim-patch:9.0.1455: C++ 20 modules are not recognized (#23124)
Problem:    C++ 20 modules are not recognized.
Solution:   Add patterns to recognize C++ 20 modules as "cpp". (Ben Jackson,
            closes vim/vim#12261)

732d69e191

Co-authored-by: Ben Jackson <puremourning@gmail.com>
2023-04-16 10:59:04 +02:00
zeertzjq
a81c137251 vim-patch:9.0.1456: shortmess test depends on order of test execution
Problem:    Shortmess test depends on order of test execution.
Solution:   Clear messages. (closes vim/vim#12264)

657b31fa3b
2023-04-16 16:12:52 +08:00
zeertzjq
e24a84f18e vim-patch:9.0.1064: code for making 'shortmess' temporarily empty is repeated
Problem:    Code for making 'shortmess' temporarily empty is repeated.
Solution:   Add functions for making 'shortmess' empty and restoring it.
            (Christian Brabandt, closes vim/vim#11709)

9aee8ec400

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-04-16 16:12:52 +08:00
zeertzjq
8a59d04a31 test(unit): add test for os_mkdir_recurse "created" 2023-04-16 15:04:41 +08:00
zeertzjq
f39b33ee49 vim-patch:9.0.0411: only created files can be cleaned up with one call
Problem:    Only created files can be cleaned up with one call.
Solution:   Add flags to mkdir() to delete with a deferred function.
            Expand the writefile() name to a full path to handle changing
            directory.

6f14da15ac

vim-patch:8.2.3742: dec mouse test fails without gnome terminfo entry

Problem:    Dec mouse test fails without gnome terminfo entry.
Solution:   Check if there is a gnome entry. Also fix 'acd' test on
            MS-Windows. (Dominique Pellé, closes vim/vim#9282)

f589fd3e10

Cherry-pick test_autochdir.vim changes from patch 9.0.0313.
Cherry-pick test_autocmd.vim changes from patch 9.0.0323.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-16 15:04:41 +08:00
zeertzjq
7b05ddbb72 vim-patch:9.0.0397: :defer not tested with exceptions and ":qa!"
Problem:    :defer not tested with exceptions and ":qa!".
Solution:   Test :defer works when exceptions are thrown and when ":qa!" is
            used.  Invoke the deferred calls on exit.

58779858fb

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-16 15:04:41 +08:00
zeertzjq
335bef0c21 vim-patch:9.0.0390: cannot use a partial with :defer
Problem:    Cannot use a partial with :defer.
Solution:   Add the partial arguments before the other arguments.  Disallow
            using a dictionary.

86d87256c4

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-16 15:04:41 +08:00
zeertzjq
0167649ce4 vim-patch:9.0.0379: cleaning up after writefile() is a hassle
Problem:    Cleaning up after writefile() is a hassle.
Solution:   Add the 'D' flag to defer deleting the written file.  Very useful
            in tests.

806a273f3c

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-16 15:04:41 +08:00
zeertzjq
b75634e55e vim-patch:9.0.0370: cleaning up afterwards can make a function messy
Problem:    Cleaning up afterwards can make a function messy.
Solution:   Add the :defer command.

1d84f7608f

Omit EX_EXPR_ARG: Vim9 script only.
Make :def throw E319 to avoid confusing behavior.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-16 15:04:40 +08:00
zeertzjq
d7965293ec vim-patch:8.2.3786: test fails because of using Vim9 syntax in legacy function
Problem:    Test fails because of using Vim9 syntax in legacy function.
Solution:   Add "call".

4f16e9de98

Add test_nested_function.vim changes from patches 8.{0.0141,2.1432}.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-16 10:18:39 +08:00
zeertzjq
68ca16c376 vim-patch:8.2.3783: confusing error for using a variable as a function
Problem:    Confusing error for using a variable as a function.
Solution:   If a function is not found but there is a variable, give a more
            useful error. (issue vim/vim#9310)

2ef9156b42

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-16 10:15:15 +08:00
zeertzjq
f4d3e279e8 vim-patch:8.2.2977: crash when using a null function reference
Problem:    Crash when using a null function reference. (Naohiro Ono)
Solution:   Check for an invalid function name. (closes vim/vim#8367)

22db0d549f

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-16 10:15:15 +08:00
zeertzjq
08121ef69f vim-patch:8.2.2848: crash whn calling partial
Problem:    Crash whn calling partial.
Solution:   Check for NULL pointer. (Dominique Pellé, closes vim/vim#8202)

fe8ebdbe5c

Co-authored-by: Dominique Pelle <dominique.pelle@gmail.com>
2023-04-16 10:15:15 +08:00
zeertzjq
d13222649a vim-patch:8.2.1945: crash when passing NULL function to reduce()
Problem:    Crash when passing NULL function to reduce().
Solution:   Check for NULL pointer and give an error. (Dominique Pellé,
            closes vim/vim#7243)

0d90e728fe

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-16 10:15:13 +08:00
zeertzjq
6adfd24a06
vim-patch:8.2.4716: memory allocation failure not tested when defining a function (#23117)
Problem:    Memory allocation failure not tested when defining a function.
Solution:   Add a test. (Yegappan Lakshmanan, closes vim/vim#10127)

7c7e19cf50

test_alloc_fail() is N/A.

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-04-16 08:26:42 +08:00
dundargoc
c08b030761
refactor: deprecate checkhealth functions
The following functions are deprecated and will be removed in
Nvim v0.11:

- health#report_start()
- health#report_info()
- health#report_ok()
- health#report_warn()
- health#report_error()
- vim.health.report_start()
- vim.health.report_info()
- vim.health.report_ok()
- vim.health.report_warn()
- vim.health.report_error()

Users should instead use these:

- vim.health.start()
- vim.health.info()
- vim.health.ok()
- vim.health.warn()
- vim.health.error()
2023-04-15 23:40:48 +02:00
zeertzjq
c5ec823a14 vim-patch:9.0.1431: getscriptinfo() loops even when specific SID is given
Problem:    getscriptinfo() loops even when specific SID is given.
Solution:   Only loop when needed.  Give a clearer error message.
            (closes vim/vim#12207)

2d68b722e3
2023-04-15 21:06:17 +08:00
zeertzjq
e9b4f51051 vim-patch:9.0.0303: it is not easy to get information about a script
Problem:    It is not easy to get information about a script.
Solution:   Make getscriptinf() return the version.  When selecting a specific
            script return functions and variables. (Yegappan Lakshmanan,
            closes vim/vim#10991)

2f892d8663

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-04-15 21:06:17 +08:00
zeertzjq
bcc971de15 vim-patch:9.0.0269: getscriptinfo() does not include the version
Problem:    getscriptinfo() does not include the version.  Cannot select
            entries by script name.
Solution:   Add the "version" item and the "name" argument. (Yegappan
            Lakshmanan, closes vim/vim#10962)

520f6ef60a

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-04-15 21:06:16 +08:00
zeertzjq
c6ebcd523d vim-patch:9.0.0104: going beyond allocated memory when evaluating string constant
Problem:    Going beyond allocated memory when evaluating string constant.
Solution:   Properly skip over <Key> form.

1e56bda904

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-15 19:01:24 +08:00
zeertzjq
29efd54e02 vim-patch:8.2.4934: string interpolation fails when not evaluating
Problem:    String interpolation fails when not evaluating.
Solution:   Skip the expression when not evaluating. (closes vim/vim#10398)

70c41241c2

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-15 19:01:19 +08:00
zeertzjq
ef9af89da7 vim-patch:8.2.4930: interpolated string expression requires escaping
Problem:    Interpolated string expression requires escaping.
Solution:   Do not require escaping in the expression.

0abc2871c1

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-15 18:19:17 +08:00
zeertzjq
bacb5021d4 vim-patch:8.2.4883: string interpolation only works in heredoc
Problem:    String interpolation only works in heredoc.
Solution:   Support interpolated strings.  Use syntax for heredoc consistent
            with strings, similar to C#. (closes vim/vim#10327)

2eaef106e4

Cherry-pick Test_Debugger_breakadd_expr() from Vim.

Co-authored-by: LemonBoy <thatlemon@gmail.com>
2023-04-15 17:59:32 +08:00
zeertzjq
2cf8f01e7d vim-patch:8.2.4840: heredoc expression evaluated even when skipping
Problem:    Heredoc expression evaluated even when skipping.
Solution:   Don't evaluate when "skip" is set. (closes vim/vim#10306)

05c7f5d3d0

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-15 17:40:31 +08:00
zeertzjq
3ad8c08acc vim-patch:8.2.4770: cannot easily mix expression and heredoc
Problem:    Cannot easily mix expression and heredoc.
Solution:   Support  in heredoc. (Yegappan Lakshmanan, closes vim/vim#10138)

efbfa867a1

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-04-15 17:40:31 +08:00
zeertzjq
1b556c04bf vim-patch:8.2.4476: operator name spelled wrong
Problem:    Operator name spelled wrong.
Solution:   Change trinary to ternary. (Goc Dundar, closes vim/vim#9850)

e41c1dd889

Co-authored-by: =?UTF-8?q?Dundar=20G=C3=B6c?= <gocdundar@gmail.com>
2023-04-15 17:15:04 +08:00
zeertzjq
408e5d16a9 vim-patch:8.2.4373: expression test fails
Problem:    Expression test fails.
Solution:   Make the test work with latest Vim9 syntax.

c87aa34dfd

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-15 17:14:49 +08:00
zeertzjq
b29df57ba7 vim-patch:8.2.4361: Vim9: some tests fail
Problem:    Vim9: some tests fail.
Solution:   Fix the tests, mostly by removing "s:".

62b191c387

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-15 17:14:30 +08:00
zeertzjq
f04125a935 vim-patch:8.2.3856: Vim9: not enough tests
Problem:    Vim9: not enough tests.
Solution:   Run more expression tests also with Vim9. Fix an uncovered
            problem.

fea43e44c0

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-15 17:09:42 +08:00
zeertzjq
700152fbf8 vim-patch:8.2.1378: cannot put space between function name and paren
Problem:    Cannot put space between function name and paren.
Solution:   Allow this for backwards compatibility.

bbd3e3c357

This fixes a regression from patch 8.2.1365, which isn't ported yet.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-15 17:09:41 +08:00
zeertzjq
85741677c8 vim-patch:8.2.0634: crash with null partial and blob
Problem:    Crash with null partial and blob.
Solution:   Check for NULL pointer.  Add more tests. (Yegappan Lakshmanan,
            closes vim/vim#5984)

92b83ccfda

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-15 13:48:30 +08:00
zeertzjq
4b49f312a0 vim-patch:8.2.0633: crash when using null partial in filter()
Problem:    Crash when using null partial in filter().
Solution:   Fix crash.  Add more tests. (Yegappan Lakshmanan, closes vim/vim#5976)

9d8d0b5c64

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-15 13:31:10 +08:00
zeertzjq
3d80392cab vim-patch:8.2.0104: using channel or job with ":execute" has strange effects
Problem:    Using channel or job with ":execute" has strange effects.
Solution:   Give an error message for Job and Channel.

b662591e50

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-15 13:17:20 +08:00
zeertzjq
4c276bbd18 vim-patch:8.2.0103: using null object with execute() has strange effects
Problem:    Using null object with execute() has strange effects.
Solution:   Give an error message ofr Job and Channel.

e2a8f0773e

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-15 13:15:10 +08:00
zeertzjq
d372eedcfa vim-patch:8.2.0102: messages test fails in small version
Problem:    Messages test fails in small version.
Solution:   Only use test_null_job() when available.

da292b07af

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-15 13:10:27 +08:00