Commit Graph

22691 Commits

Author SHA1 Message Date
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
zeertzjq
e8618df7f8
vim-patch:8.2.3619: cannot use a lambda for 'operatorfunc' (#19846)
Problem:    Cannot use a lambda for 'operatorfunc'.
Solution:   Support using a lambda or partial. (Yegappan Lakshmanan,
            closes vim/vim#8775)
777175b0df

Omit duplicate docs. It's removed in patch 8.2.3623.
Nvim doesn't seem to need callback_set() as it was omitted when patch 8.1.1437
was first ported.
2022-08-20 06:12:02 +08:00
bfredl
ebd5720901
Merge pull request #19841 from bfredl/drawstatus
refactor: move statusline code from buffer.c and [draw]screen.c to new file
2022-08-20 00:05:32 +02:00
bfredl
6adc2ae7e0 refactor: move statusline code from buffer.c and [draw]screen.c to new file
problem: code for drawing statusline is arbitrarily spreadout between drawscreen.c, screen.c and buffer.c
solution: move it to a new file statusline.c

- rename archaic internal name "status match" to public name "wildmenu"
- showruler() does not show the ruler. it show anything which displays
  info about the cursor. Rename it accordingy.
2022-08-19 22:48:03 +02:00
Christian Clason
b2f979b30b
fix(filetype): only check first 100 and last line of buffer (#19819)
fix(filetype): only pass first 100 and last lines to contents check

sufficient for current content checks and avoids performance issues for
buffers with a large number of lines

fixes #19817
2022-08-19 19:30:35 +02:00
Christian Clason
7e980a4df4
docs(lua): update vim.{g,b,w}o documentation (#19844)
docs(lua): update vim.{go,bo,wo} documentation

* document indexing by buffer/window handle
* correct wrapper information (`nvim_buf_{g,s}et_value` now)
* make clear what is considered "invalid key" (consistently)
2022-08-19 19:05:28 +02:00
Lewis Russell
7d815eb4d9 refactor(drawline.c): factor out utf8 multibyte check 2022-08-19 16:54:27 +01:00
bfredl
3c545b9c62
Merge pull request #19360 from famiu/feat/multibuffer-inccommand
feat: multibuffer preview support for inccommand
2022-08-19 17:21:18 +02:00
zeertzjq
dc32cc5acf
Merge pull request #19845 from zeertzjq/vim-8.2.0982
vim-patch:8.2.{partial:0425,0982}: insufficient tests
2022-08-19 22:27:43 +08:00
zeertzjq
b7c86e24f7 vim-patch:8.2.0982: insufficient testing for reading/writing files
Problem:    Insufficient testing for reading/writing files.
Solution:   Add more tests. (Yegappan Lakshmanan, closes vim/vim#6257)
            Add "ui_delay" to test_override() and use it for the CTRL-O test.
b340baed9f

Omit test_override().
Reorder test_writefile.vim to match Vim.
2022-08-19 22:05:26 +08:00
zeertzjq
efebf30784 vim-patch:partial:8.2.0425: code for modeless selection not sufficiently tested
Problem:    Code for modeless selection not sufficiently tested.
Solution:   Add tests.  Move mouse code functionality to a common script file.
            (Yegappan Lakshmanan, closes vim/vim#5821)
515545e11f

Skip termcode tests for now.
2022-08-19 22:05:23 +08:00
zeertzjq
7ff283b1b7
Merge pull request #19843 from zeertzjq/vim-9.0.0227
vim-patch:8.2.3946,9.0.0227: internal error improvements
2022-08-19 21:02:38 +08:00
zeertzjq
4edf967050 vim-patch:9.0.0227: cannot read error message when abort() is called
Problem:    Cannot read error message when abort() is called.
Solution:   Output a newline before calling abort().
213e70e284

Add emsg_not_now() check to make code equivalent.
2022-08-19 20:39:17 +08:00
zeertzjq
aa96a80d5d vim-patch:8.2.3946: when an internal error makes Vim exit the error is not seen
Problem:    When an internal error makes Vim exit the error is not seen.
Solution:   Add the error to the test output.
1c67f3a977

Add emsg_not_now() check to make code equivalent.
2022-08-19 20:38:59 +08:00
zeertzjq
2af9be3db5
vim-patch:8.1.1966: some code in options.c fits better elsewhere (#19840)
Problem:    Some code in options.c fits better elsewhere.
Solution:   Move functions from options.c to other files. (Yegappan
            Lakshmanan, closes vim/vim#4889)
e677df8d93
2022-08-19 19:20:39 +08:00
Lewis Russell
5dc43265b1
Merge pull request #19802 from lewis6991/drawscreen 2022-08-19 10:41:45 +01:00
Lewis Russell
51063a90df vim-patch:8.1.2057: the screen.c file is much too big
Problem:    The screen.c file is much too big.
Solution:   Split it in three parts. (Yegappan Lakshmanan, closes vim/vim#4943)
7528d1f6b5

This is an approximation vim-patch 8.1.2057. Applying the patch directly
isn't feasible since our version of screen.c has diverged too much,
however we still introduce drawscreen.c and drawline.c:
- screen.c is now a much smaller file used for low level screen functions
- drawline.c contains everything needed for win_line()
- drawscreen.c contains everything needed for update_screen()

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2022-08-19 10:01:40 +01:00
Famiu Haque
c2f7a2a18d feat: multibuffer preview support for inccommand
Allows preview callbacks to modify multiple buffers in order to show the
preview. Previously, if multiple buffers were modified, only the current
buffer would have its state restored. After this change, all buffers
have their state restored after preview.

Closes #19103.
2022-08-19 09:27:52 +06:00
Lewis Russell
a5ed89c972
refactor(undo.c): resolve clint issues (#19827) 2022-08-18 15:16:52 +01:00
zeertzjq
36f0b508c5
revert: "jobstart(): Fix hang on non-executable cwd #9204" (#19826)
This reverts commit c4c74c3883.

LibUV already gives an error for this, so this isn't needed.
2022-08-18 22:09:50 +08:00
bfredl
700a6fb9d4
Merge pull request #19822 from bfredl/hldef
fix(api): make nvim_set_hl(ns=0, ...) redraw screen properly
2022-08-18 12:16:27 +02:00
Christian Clason
39494be2a4
ci: add codeql action (#19810)
replaces deprecated LGTM workflow:
https://github.blog/2022-08-15-the-next-step-for-lgtm-com-github-code-scanning/
2022-08-18 11:55:15 +02:00
bfredl
7a2be8cc17
Merge pull request #19828 from bfredl/nullhl
fix(winhl): do not crash when unsetting winhl in just opened window
2022-08-18 11:12:50 +02:00
zeertzjq
fbcce2b2ca
vim-patch:8.1.2082: rename popupmnu.* to popupmenu.* (#19829)
vim-patch:8.1.2082: some files have a weird name to fit in 8.3 characters

Problem:    Some files have a weird name to fit in 8.3 characters.
Solution:   Use a nicer names.
30e8e73506
2022-08-18 17:06:39 +08:00
bfredl
e29156356b fix(api): make nvim_set_hl(ns=0, ...) redraw screen properly
fixes #18160
2022-08-18 10:57:46 +02:00
Mathias Fußenegger
341ef46d00
docs(lsp): remove lsp.buf_request from docs (#19738)
This starts a soft phase-out of `buf_request`.

`buf_request` is quite error prone:

- Positional `params` depend on the client because of the
  `offset_encoding`. Currently if there is one client using UTF-8 offset
  encoding and another using UTF-16, the positions in the request are
  wrong for one of the clients. To solve this the params would need to
  be created per client instead of once for all of them.

- `handler` is called *per* client but many users of it assume it is
  only called once.

  This can lead to a "select n + 1"
  kind of problem, where the handler makes another call to `buf_request`,
  multiplying the amount of requests.
  (There are in fact still some places where this happens in core)

  Or it leads to erratic behavior if called multiple times (E.g. the
  quicklist list flickering & being overwritten)
  (See hover or references implementation)

  `buf_request_all` returns an aggregate of the responses which is more
  sensible as it avoids this problem.

  For off-spec extensions it also has the problem that it sends requests to
  clients which cannot handle a given request.

Given that `buf_request` is in use by a lot of plugins this starts a
soft-phase out. Planned Steps:

- Remove from docs
- Provide an alternative, either `buf_request_all`, maybe with
  extensions (params being a function), or an entirely new method.
- Mark as deprecated in 0.9
- Remove in 0.10

To note:

- `buf_request_all` currently isn't ideal either because it suffers from
the `params` problem as well.

- This implies that the `vim.lsp.with` pattern will die, because the
  global handlers as they are don't fit a multi-client model, as most of
  the time an aggregate is needed.
2022-08-18 10:57:17 +02:00