Commit Graph

22766 Commits

Author SHA1 Message Date
zeertzjq
9a100ee169
fix(cmdline): do not trigger completion at wrong time (#19920)
Cherry-picked from Vim patches 8.2.4339, 9.0.0238.
2022-08-24 10:28:32 +08:00
zeertzjq
64d147b471
vim-patch:9.0.0248: duplicate code in finding a script in the execution stack (#19917)
Problem:    Duplicate code in finding a script in the execution stack.
Solution:   Reduce duplicate code. (closes vim/vim#10961)
a247142ae4
2022-08-24 06:28:37 +08:00
bfredl
c0d6052654 perf(api): allow to use an arena for return values 2022-08-23 18:34:24 +02:00
zeertzjq
6cc6e11929
vim-patch:9.0.0206: redraw flags are not named specifically (#19913)
Problem:    Redraw flags are not named specifically.
Solution:   Prefix "UPD_" to the flags, for UPDate_screen().
a4d158b3c8
2022-08-23 22:00:19 +08:00
Lewis Russell
779a25f040
refactor(spell.c): resolve clint errors (#19875)
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2022-08-23 14:30:02 +01:00
Lewis Russell
0c0a426e40
doc(CONTRIBUTING): update #19891
- add section for managing includes via IWYU
- recommend clangd over ctags
- tidy up links
- remove ./scripts/check-includes.py
2022-08-23 06:18:05 -07:00
Simon Wachter
e892b7b383
fix(inspect): escape identifiers that are lua keywords (#19898)
A lua keyword is not a valid table identifier
2022-08-23 13:02:55 +02:00
zeertzjq
df4709ddf6
Merge pull request #19905 from zeertzjq/vim-8.2.4726
vim-patch:8.2.{4726,4740,4741,4749,4841,4842}: expand('<script>')
2022-08-23 18:12:28 +08:00
zeertzjq
d459b66877 vim-patch:8.2.4842: expand("%:p") is not empty when there is no buffer name
Problem:    expand("%:p") is not empty when there is no buffer name.
Solution:   When ignoring errors still return NULL. (closes vim/vim#10311)
211a5bb235
2022-08-23 17:48:12 +08:00
zeertzjq
f1b8683b8c vim-patch:8.2.4841: empty string considered an error for expand()
Problem:    Empty string considered an error for expand() when 'verbose' is
            set. (Christian Brabandt)
Solution:   Do not give an error for an empty result. (closes vim/vim#10307)
a96edb736d
2022-08-23 17:48:12 +08:00
zeertzjq
d0b9fe2d5a vim-patch:8.2.4749: <script> is not expanded in autocmd context
Problem:    <script> is not expanded in autocmd context.
Solution:   Add the context to the pattern struct. (closes vim/vim#10144)
            Rename AutoPatCmd to AutoPatCmd_T.
eca7c60d68

Omit AutoPatCmd -> AutoPatCmd_T rename as it is inconsistent.
Use `.sn_name` instead of `->sn_name` as v8.2.0154 hasn't been ported.
Omit acp_script_stx(), use member directly.
2022-08-23 17:48:12 +08:00
zeertzjq
7afc17dec1 vim-patch:8.2.4741: startup test fails
Problem:    Startup test fails.
Solution:   Avoid an error for verbose expansion.  Fix that the "0verbose"
            command modifier doesn't work.
60895f3e36

Most code changes has already been ported.
2022-08-23 17:48:12 +08:00
zeertzjq
a9e6cf0e64 vim-patch:8.2.4740: when expand() fails there is no error message
Problem:    When expand() fails there is no error message.
Solution:   When 'verbose' is set give an error message.
575445200b
2022-08-23 17:48:12 +08:00
zeertzjq
ffa1335047 vim-patch:8.2.4726: cannot use expand() to get the script name
Problem:    Cannot use expand() to get the script name.
Solution:   Support expand('<script>'). (closes vim/vim#10121)
6013d0045d

Use `.sn_name` instead of `->sn_name` as v8.2.0154 hasn't been ported.
Cherry-pick builtin.txt expand() doc from latest Vim.
2022-08-23 17:47:46 +08:00
zeertzjq
42e9fe7d95
test: add test for using :normal to stop Visual mode in cmdwin (#19904) 2022-08-23 11:39:25 +08:00
zeertzjq
63df91c10a
vim-patch:8.2.1046: insufficient tests for src/buffer.c (#19903)
Problem:    Insufficient tests for src/buffer.c.
Solution:   Add more tests.  Move comments related tests to a separate file.
            (Yegappan Lakshmanan, closes vim/vim#6325)
b7e2483655
2022-08-23 11:24:46 +08:00
zeertzjq
d5328ea408
vim-patch:8.2.0522: several errors are not tested for (#19901)
Problem:    Several errors are not tested for.
Solution:   Add tests. (Yegappan Lakshmanan, closes vim/vim#5892)
ee4e0c1e9a

Omit Test_range() change: reverted in patch 8.2.0615.
Cherry-pick Test_z_no_space_before_xxx() from patch 8.2.0195.
Cherry-pick Test_reverse_sort_uniq() change from patch 8.2.0183.
Make uniq() error behavior consistent with sort().
Cherry-pick Test_set_ttytype() change from patch 8.1.1826.
Cherry-pick quickfix checks from patch 8.1.2373 to test_preview.vim.
Test_viminfo_error() is applicable.
Cherry-pick E1058 from patch 8.2.0149 and port Test_deep_nest() to Lua.
2022-08-23 10:38:53 +08:00
zeertzjq
48a4657aee
vim-patch:8.1.{1915,1921,1953} (#19900)
vim-patch:8.1.1915: more functions can be used as methods

Problem:    More functions can be used as methods.
Solution:   Make various functions usable as a method.
1a3a89168d

Move debugbreak() to the right place.

vim-patch:8.1.1921: more functions can be used as methods

Problem:    More functions can be used as methods.
Solution:   Make various functions usable as a method.
a4208966fb

vim-patch:8.1.1953: more functions can be used as a method

Problem:    More functions can be used as a method.
Solution:   Allow more functions to be used as a method.
f9f24ce7a0

Omit test_termcodes.vim: cannot be used and superseded by later patches.
Cherry-pick test_bufline.vim change from patch 8.1.1993.
2022-08-23 08:36:22 +08:00
zeertzjq
2fd25fb909
vim-patch:8.1.0832: confirm() is not tested (#19896)
Problem:    confirm() is not tested.
Solution:   Add a test. (Dominique Pelle, closes vim/vim#3868)
2e05009218
2022-08-23 07:20:23 +08:00
zeertzjq
baaaa1f2b3
vim-patch:8.2.3421: a bit of code is not covered by tests (#19895)
Problem:    A bit of code is not covered by tests.
Solution:   Add a few more test cases. (Dominique Pellé, closes vim/vim#8857)
d176ca3dde

Cherry-pick Test_trim() change from patch 8.2.0448.
Cherry-pick Test_History() change from patch 8.2.1736.
Cherry-pick charidx() and trim() type checks from patch 8.2.3135.
2022-08-22 22:09:53 +08:00
Thomas Vigouroux
3c1d70f20b
feat(treesitter): allow customizing language symbol name 2022-08-22 15:34:10 +02:00
zeertzjq
15a768eeb0
fix(api): avoid side effects with nvim_parse_cmd (#19890)
Save and restore the cursor and last search pattern and do not change
search history.
2022-08-22 18:06:18 +08:00
zeertzjq
2bed0d1d97
vim-patch:8.2.4753: error from setting an option is silently ignored (#19888)
Problem:    Error from setting an option is silently ignored.
Solution:   Handle option value errors better.  Fix uses of N_().
31e5c60a68
2022-08-22 13:56:50 +08:00
Axel Forsman
d4d27c41b3
fix(edit.c): indentkeys double indent after "!" #12894
which is both unexpected and different from the Vim behaviour.

Indent was triggered once by the '!' check in insert_execute(), and
inserting the char was correctly skipped, but then triggered again in
insert_check() (provided that cindent was not being ignored after manual
indentation, i.e. `can_cindent == true`).

While this is the smallest fix, another solution would be to remove
VimState#check and instead move that to *_enter()/-_execute(), since the
control flow is pretty unnecessarily convoluted as is. That would also
have the benefit of differing less from the Vim source code.
2022-08-21 21:48:18 -07:00
zeertzjq
4f6d0d6da9
vim-patch:8.2.2289: Vim9: 'cpo' can become empty (#19887)
Problem:    Vim9: 'cpo' can become empty.
Solution:   Use empty_option instead of an empty string.  Update quickfix
            buffer after restoring 'cpo'.  (closes vim/vim#7608)
e5a2dc87fd

Omit test as it is Vim9 script.
2022-08-22 12:02:45 +08:00
zeertzjq
d5cc161dea
Merge pull request #19886 from zeertzjq/vim-8.2.2030
vim-patch:8.2.{2030,2031}: some tests fail
2022-08-22 10:15:00 +08:00
zeertzjq
b94cfaf080 vim-patch:8.2.2031: some tests fail when run under valgrind
Problem:    Some tests fail when run under valgrind.
Solution:   Avoid timing problems.
18dc355395
2022-08-22 09:53:09 +08:00
zeertzjq
af2b078258 vim-patch:8.2.2030: some tests fail on Mac
Problem:    Some tests fail on Mac.
Solution:   Avoid Mac test failures.  Add additional test for wildmenu.
            (Yegappan Lakshmanan, closes vim/vim#7341)
4b2ce1297e
2022-08-22 09:53:07 +08:00
zeertzjq
72b03792b6
Merge pull request #19885 from zeertzjq/vim-8.2.4328
vim-patch:8.2.{4328,4334}: wildmenu tests
2022-08-22 09:27:55 +08:00
zeertzjq
06a53ab2cb vim-patch:8.2.4334: command line popup menu not positioned correctly
Problem:    Command line popup menu not positioned correctly.
Solution:   Also use vim_strsize() on the existing text. (Naruhiko Nishino,
            closes vim/vim#9727)
68cc2b8a37
2022-08-22 09:08:47 +08:00
zeertzjq
99bd895956 vim-patch:8.2.4328: command line complete matches cleard when typing character
Problem:    Command line complete matches cleard when typing character.
            (Dominique Pellé)
Solution:   Only remove a popup menu if there is one.
73a16c22a4
2022-08-22 08:55:54 +08:00
bfredl
c086bf6079
Merge pull request #19864 from lewis6991/decorfix
fix(ui): don't allow decor provider with ns_id==0
2022-08-21 21:11:56 +02:00
zeertzjq
2379699b1e
vim-patch:9.0.0236: popup menu not removed when 'wildmenu' reset while visible (#19882)
Problem:    Popup menu not removed when 'wildmenu' reset while it is visible.
Solution:   Do not check p_wmnu, only pum_visible(). (closes vim/vim#10953)
b82a2ab8ad
2022-08-21 22:03:26 +08:00
zeertzjq
e3eb6967bc
vim-patch:8.2.4325: 'wildmenu' only shows few matches (#19876)
Problem:    'wildmenu' only shows few matches.
Solution:   Add the "pum" option: use a popup menu to show the matches.
            (Yegappan Lakshmanan et al., closes vim/vim#9707)
3908ef5017

Omit p_wmnu check in cmdline_pum_active() as it can cause problems.
Omit vim_strchr() flags as that isn't really better than bitmasks.
Omit key translations and document it in vim_diff.txt.
2022-08-21 21:31:25 +08:00
Javier Lopez
dde90f0ca4
fix(api/command): fargs behavior when no arguments are passed (#19862)
Problem: A command defined with `nargs="?"` returns `fargs={""}` to
a Lua callback when executed with no arguments, which is inconsistent
with how`nargs="*"` behaves.

Solution: Pass `fargs={}` for no argument with `nargs="?"` as well.
2022-08-21 15:19:29 +02:00
zeertzjq
5928d5c2f1
vim-patch:9.0.0234: cannot make difference between :normal end and argument char (#19879)
Problem:    Cannot make difference between the end of :normal and a character
            in its argument.
Solution:   Add the "typebuf_was_empty" flag. (closes vim/vim#10950)
8d69637133
2022-08-21 19:37:11 +08:00
zeertzjq
6b9852cc41
vim-patch:8.2.4754: using cached values after unsetting some environment variables (#19872)
Problem:    Still using cached values after unsetting some known environment
            variables.
Solution:   Take care of the side effects. (closes vim/vim#10194)
7714231bb5

Cherry-pick vim_setenv_ext() from patch 8.2.0200.
2022-08-21 11:37:13 +08:00
zeertzjq
506a3ec913
refactor: make wildmenu code closer to Vim (#19870)
This is a small refactor that makes `compl_match_array` static and
doesn't change any behavior.
2022-08-21 11:06:07 +08:00
zeertzjq
61ff37952a
vim-patch:8.2.1587: loop for handling keys for the command line is too long (#19868)
Problem:    Loop for handling keys for the command line is too long.
Solution:   Move wild menu handling to separate functions. (Yegappan
            Lakshmanan, closes vim/vim#6856)
eadee486c7
2022-08-21 09:18:47 +08:00
zeertzjq
741ef87876
vim-patch:8.1.1914: command line expansion code is spread out (#19867)
Problem:    Command line expansion code is spread out.
Solution:   Move set_one_cmd_context(). (Yegappan Lakshmanan, closes vim/vim#4855)
d019039ccd
2022-08-21 08:05:39 +08:00
zeertzjq
76d35a5a36
vim-patch:9.0.0231: expanding "**" may loop forever with directory links (#19866)
Problem:    Expanding "**" may loop forever with directory links.
Solution:   Check for being interrupted. (closes vim/vim#10946)
57e95179ab
2022-08-21 07:08:09 +08:00
zeertzjq
0d0a336c53
vim-patch:8.1.1886: command line expansion code is spread out (#19861)
Problem:    Command line expansion code is spread out.
Solution:   Move the code to cmdexpand.c. (Yegappan Lakshmanan, closes vim/vim#4831)
66b51420e0
2022-08-21 06:33:24 +08:00
Lewis Russell
5e15452043 fix(ui): don't allow decor provider with ns_id==0
Fixes #19831
2022-08-20 19:05:22 +01:00
zeertzjq
ff5cfcdeab
vim-patch:8.1.2045: the option.c file is too big (#19854)
Problem:    The option.c file is too big.
Solution:   Split off the code dealing with strings. (Yegappan Lakshmanan,
            closes vim/vim#4937)
dac1347b4d

Cherry-pick set_string_option_direct_in_win() from patch 8.1.1405.
Cherry-pick shift_line() comment change from patch 8.1.2096.
Move 'clipboard' default parsing to didset_string_options().
Reorder option flags to put Nvim-only flags at the end.
2022-08-20 17:26:44 +08:00
Christian Clason
1cc4706e94
vim-patch:e80086446cc2 (#19848)
* vim-patch:e80086446cc2

Update runtime files
e80086446c

Co-authored-by: Sean Dewar <seandewar@users.noreply.github.com>
2022-08-20 10:04:55 +02:00
zeertzjq
bffaf1e27e
fix(eval): check for v:lua when calling callback (#19855)
This makes callback_call() match call_vim_function() when calling a function.
2022-08-20 15:52:35 +08:00
zeertzjq
1a57cd3836
Merge pull request #19852 from zeertzjq/vim-8.2.3623
vim-patch:8.2.{3623,4667}: expandcmd() fixes
2022-08-20 07:49:31 +08:00
zeertzjq
15ca01b649 vim-patch:8.2.4667: expandcmd() fails on an error
Problem:    expandcmd() fails on an error.
Solution:   On failure return the command unmodified. (yegappan Lakshmanan,
            closes vim/vim#10063)
5018a836c0
2022-08-20 07:25:22 +08:00
zeertzjq
6d6e9c5d51 vim-patch:8.2.3623: "$*" is expanded to "nonomatch"
Problem:    "$*" is expanded to "nonomatch".
Solution:   Only add "set nonomatch" when using a csh-like shell. (Christian
            Brabandt, closes vim/vim#9159, closes vim/vim#9153)
8b8d829faf

Cherry-pick a line from patch 8.2.0522.
2022-08-20 07:25:22 +08:00
Lewis Russell
f342194396
Merge pull request #19847 from lewis6991/utfmb
refactor(drawline.c): factor out utf8 multibyte check
2022-08-19 23:28:20 +01:00