Commit Graph

4377 Commits

Author SHA1 Message Date
bfredl
068a998e60 fix(tests): remove irrelevant usage of display-=msgsep
These were just added to avoid churn when changing the default
of 'display'. To simplify message handling logic, we might want
to remove support for printing messages in default_grid later on.
This would allow things like printing error messages safely in the
middle of redraw, or a future graduation of the 'multigrid' feature.
2022-08-17 23:44:49 +02:00
bfredl
d879331b0d feat(ui): allow to set the highlight namespace per window
- reimplement 'winhl' in terms of highlight namespaces
- check for EOF in screen tests (to indicate a likely crash)
2022-08-17 16:20:39 +02:00
Famiu Haque
f5588ee896
feat: allow :wincmd to accept a count (#19815)
Let :wincmd command accept a count like what its documentation suggests.
Previously it could only accept a range, which led to some ambiguity on
which attribute should be used when executing :wincmd using nvim_cmd.

Closes #19662.

Also fix a typo in a related Vim test:

vim-patch:9.0.0223: typo in diffmode test

Problem:    Typo in diffmode test.
Solution:   Fix the typo. (closes vim/vim#10932)
5fd6ab820b
2022-08-17 19:50:40 +08:00
Shougo Matsushita
5977a96b3f vim-patch:9.0.0190: the way 'cmdheight' can be made zero is inconsistent
Problem:    The way 'cmdheight' can be made zero is inconsistent.
Solution:   Only make 'cmdheight' zero when setting it explicitly, not when
            resizing windows. (closes vim/vim#10890)
f797e309ca
2022-08-17 09:34:13 +08:00
zeertzjq
03fddfd928
fix(api): nvim_exec and nvim_cmd restore msg_col when capturing output (#19789)
This matches the code in execute_common(), preventing messages after the
API call from being printed at the wrong column.
2022-08-16 17:30:39 +08:00
zeertzjq
cf3b871fa9
test: use poke_eventloop() instead of sleep(10) where possible (#19794)
Using sleep(10) to wait for typeahead to finish is flaky, especially on
macOS, where legacy/global_spec.lua has failed several times.
2022-08-16 15:21:46 +08:00
zeertzjq
d1464d16d6 fix(source): fix expand('<sfile>') no longer works for Lua 2022-08-16 05:39:44 +08:00
zeertzjq
76b4b1977b vim-patch:8.2.1799: some Normal mode commands not fully tested
Problem:    Some Normal mode commands not fully tested.
Solution:   Add a few more tests. (Yegappan Lakshmanan, closes vim/vim#7073)
d1ad99b654

Cherry-pick test_registers.vim change from patch 8.2.0644.
2022-08-15 20:24:43 +08:00
zeertzjq
55da52963b vim-patch:8.2.5109: mode not updated after CTRL-O CTRL-C in Insert mode
Problem:    Mode not updated after CTRL-O CTRL-C in Insert mode.
Solution:   Set redraw_mode and use it. (closes vim/vim#10581)
7a1d32809b
2022-08-15 17:58:35 +08:00
zeertzjq
93ba821831 vim-patch:8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Problem:    Mode is not cleared when leaving Insert mode with mapped Esc.
Solution:   Clear the mode when redraw_cmdline is set. (closes vim/vim#4269)
4c25bd785a
2022-08-15 17:58:35 +08:00
zeertzjq
53b0688ac0 vim-patch:8.1.1189: mode is not cleared when leaving Insert mode
Problem:    Mode is not cleared when leaving Insert mode.
Solution:   Clear the mode when got_int is set. (Ozaki Kiichi, closes vim/vim#4270)
abc7c7fc5a
2022-08-15 17:58:35 +08:00
zeertzjq
b47f313151 fix(getchar): flush screen before doing a blocking wait 2022-08-15 17:58:35 +08:00
zeertzjq
95b8e2c55f vim-patch:partial:8.1.0822: peeking and flushing output slows down execution
Problem:    Peeking and flushing output slows down execution.
Solution:   Do not update the mode message when global_busy is set.  Do not
            flush when only peeking for a character. (Ken Takata)
cb574f4154

Omit inchar() change: it breaks too many tests.

N/A patches for version.c:

vim-patch:8.2.5170: tiny issues

Problem:    Tiny issues.
Solution:   Tiny improvements.
944cc9ceba
2022-08-15 17:58:35 +08:00
zeertzjq
9ab9eb1220 fix(source): make changing 'shellslash' change expand() result 2022-08-15 10:14:53 +08:00
zeertzjq
02a4974418
vim-patch:7.4.1168 (#19645)
Problem:    This doesn't give the right result: eval(string(v:true)). (Nikolay
            Pavlov)
Solution:   Make the string "v:true" instead of "true".
f48aa160fd
2022-08-13 21:31:00 +08:00
bfredl
33f4ba7379 fix(winbar): do not always assume cursor is valid. fixes #19458 2022-08-13 10:45:21 +02:00
zeertzjq
0d9e09bf67
test: make Ex mode exit test test what it wants to test (#19728) 2022-08-12 09:04:08 +08:00
Lewis Russell
a27756cc24
fix(signs): priority of extmark signs (#19718) 2022-08-11 17:26:17 +01:00
Famiu Haque
78658ef383
fix(api): vim.cmd.make crashes when argument count isn't 1 (#19701)
Closes #19696
2022-08-10 18:37:59 +08:00
zeertzjq
3030b4d653
feat(tui): allow grid and host to disagree on ambiguous-width chars (#19686)
Note: This only applies to ambiguous-width characters.
2022-08-09 21:08:46 +08:00
zeertzjq
d31ee6664d
test: increse expect_exit() timeouts (#19680)
A timeout of 100 milliseconds is sometimes still too short for macOS.
Change it to 1000 milliseconds.
2022-08-08 22:04:21 +08:00
zeertzjq
603f7bd253 fix(fillchars): change fallback after setcellwidths() 2022-08-08 20:03:40 +08:00
zeertzjq
18766e742b
fix(folds): fix fold remains when :delete makes buffer empty (#19673) 2022-08-08 06:07:59 +08:00
zeertzjq
629169462a
fix(terminal): skip aucmd_win when checking terminal size (#19668) 2022-08-07 19:43:29 +08:00
zeertzjq
48051ed62c vim-patch:8.2.1281: the "trailing characters" error can be hard to understand
Problem:    The "trailing characters" error can be hard to understand.
Solution:   Add the trailing characters to the message.
2d06bfde29
2022-08-07 14:39:19 +08:00
zeertzjq
d0686540f5 vim-patch:8.2.1280: Ex command error cannot contain an argument
Problem:    Ex command error cannot contain an argument.
Solution:   Add ex_errmsg() and translate earlier.  Use e_trailing_arg where
            possible.
8930caaa1a

Remove duplicate test file 062_tab_pages_spec.lua
2022-08-07 14:38:57 +08:00
Lewis Russell
0fdf59ac9d
fix(api): nvim_cmd handle 0 range (#19655)
Fixes #19608
2022-08-06 13:53:37 +01:00
zeertzjq
a308f53525
fix(api): fix nvim_buf_set_text heap-use-after-free (#19644)
The line returned but ml_get_buf() may be freed by another call to
ml_get_buf(), so it is necessary to make a copy.
2022-08-06 06:22:01 +08:00
zeertzjq
a78606ec53
test(let_spec): increase expect_exit() timeout
Test ":unlet self-referencing node in a List graph #6070" feeds many characters into typeahead, so a timeout of only 100 milliseconds sometimes fails. Change that timeout to 1000 milliseconds.
2022-08-05 08:32:54 +08:00
zeertzjq
0a29267514
fix(completion): remove wrong FUNC_ATTR_NONNULL_ALL (#19627) 2022-08-03 21:50:14 +08:00
ii14
3df8d9b8c5
feat(lua): print source locations of lua callbacks (#19597)
Co-authored-by: ii14 <ii14@users.noreply.github.com>
2022-08-03 13:41:17 +01:00
zeertzjq
c57e133e50
fix(ui): set redraw_cmdline when setting window height (#19630) 2022-08-03 19:25:03 +08:00
bfredl
0806c882cd
Merge pull request #19584 from bfredl/terminal_c_BSL_c_O
implement <c-\><c-o> key for terminal mode
2022-08-02 14:53:20 +02:00
zeertzjq
def0ced4c7
fix(tabpage): check if ROWS_AVAIL changed for resize (#19620)
N/A patches for version.c:

vim-patch:9.0.0135: comment about tabpage line above the wrong code

Problem:    Comment about tabpage line above the wrong code.
Solution:   Move the comment. (closes vim/vim#10836)
0b0ccbbfb0
2022-08-02 20:48:41 +08:00
bfredl
9092540315 feat(terminal): implement <c-\><c-o> for terminal mode
this works similar to <c-o> or <c-\><c-o> in insert mode
2022-08-02 13:54:41 +02:00
zeertzjq
0a049c322f
test: improve mapping tests and docs (#19619) 2022-08-02 11:13:22 +08:00
Mathias Fußenegger
e99de3f12f
fix(lsp): send didOpen if name changes on write (#19583)
`:saveas newName` changes the name of an existing buffer.
Due to the buffer re-use it skips the lsp attach phase and immediately
sends a `didSave` notification to the server.
Servers get confused about this, because they expect a `didOpen`
notification first.

Closes https://github.com/neovim/neovim/issues/18688
2022-08-01 22:32:53 +02:00
zeertzjq
d954e8da62 feat(mapset): support restoring "replace_keycodes" and "desc" 2022-08-01 21:54:18 +08:00
zeertzjq
cabb23ea4d test: fix api/keymap_spec.lua tests 2022-08-01 21:54:18 +08:00
zeertzjq
6963c2bdcd vim-patch:8.2.0815: maparg() does not provide enough information for mapset()
Problem:    maparg() does not provide enough information for mapset().
Solution:   Add "lhsraw" and "lhsrawalt" items.  Drop "simplified"
9c65253fe7

vim-patch:9.0.0127: unused variable

Problem:    Unused variable.
Solution:   Remove the variable. (closes vim/vim#10829)
e95f22f63a
2022-08-01 21:54:18 +08:00
ii14
db6e93c48d
feat(api): add replace_keycodes to nvim_set_keymap (#19598) 2022-08-01 21:35:08 +08:00
Gustavo Sampaio
ece0850b73
fix(session): respect sessionoptions=terminal #19497
fixes #13078

Co-authored-by: Yuta Katayama <8683947+yutkat@users.noreply.github.com>
2022-08-01 05:13:46 -07:00
Munif Tanjim
86110ec933
fix(highlight): add missing 'nocombine' to nvim_get_hl_* apis (#19586) 2022-07-31 13:38:00 +02:00
Shougo
c1652bdcb5
cmdheight=0: fix bugs part2 (#19185) 2022-07-31 13:13:19 +08:00
zeertzjq
0ae94a128f test: rewrite Test_missing_attr() in Lua 2022-07-31 08:51:20 +08:00
zeertzjq
d36d9be8ff
fix(terminal): avoid reading over the end of cell.chars (#19580) 2022-07-30 21:40:30 +08:00
zeertzjq
e59bc078de
fix(screen): check for col instead of vcol when drawing fold (#19572) 2022-07-29 21:47:21 +08:00
zeertzjq
f254fc67a5
vim-patch:9.0.0099: scrollback can be wrong after redrawing the command line (#19562)
Problem:    Scrollback can be wrong after redrawing the command line.
Solution:   Clear unfinished scrollback when redrawing. (closes vim/vim#10807)
46af7bc08d
2022-07-28 20:07:32 +08:00
zeertzjq
f57432af4d
vim-patch:9.0.0090: no error when assigning bool to a string option (#19539)
Problem:    No error when assigning bool to a string option with setwinvar().
Solution:   Give an error (closes vim/vim#10766)
28f84e17b0
2022-07-27 20:59:43 +08:00
zeertzjq
79872f3770
fix(options): properly free string options (#19510) 2022-07-27 07:26:32 +08:00
zeertzjq
fc55f8263c vim-patch:9.0.0086: tabline is not redrawn when entering command line
Problem:    Tabline is not redrawn when entering command line.
Solution:   Set "redraw_tabline". (closes vim/vim#10771)
6791adca53
2022-07-27 06:32:40 +08:00
zeertzjq
9f1dc1466e vim-patch:9.0.0082: cannot interrupt global command from command line
Problem:    Cannot interrupt global command from command line.
Solution:   Reset got_int in another place. (closes vim/vim#10739)
3cfae39b08
2022-07-27 06:19:43 +08:00
zeertzjq
45e2bbae83 vim-patch:9.0.0051: using CTRL-C wih :append may hang Vim
Problem:    Using CTRL-C wih :append may hang Vim.
Solution:   Reset got_int. (closes vim/vim#10729, closes vim/vim#10728)
f754fe6a3d
2022-07-27 06:19:43 +08:00
zeertzjq
147cce29a6
fix(cmdline): trigger CmdlineEnter and ModeChanged earlier (#19474)
Match Vim's ordering in code.
These tests are unrelated to ext_cmdline. Move them out of that block.
2022-07-26 10:21:30 +08:00
zeertzjq
fe159d23fd
vim-patch:9.0.0071: command overlaps with printed text in scrollback (#19505)
Problem:    Command overlaps with printed text in scrollback.
Solution:   Clear until end-of-line and use correct message chunk.
            (closes vim/vim#10765, closes vim/vim#10764)
ecdc82e74e

N/A patches for version.c:

vim-patch:9.0.0070: using utfc_ptr2char_len() when length is negative

Problem:    Using utfc_ptr2char_len() when length is negative.
Solution:   Check value of length. (closes vim/vim#10760)
4dc513a22c
2022-07-26 07:30:33 +08:00
zeertzjq
611b43369e vim-patch:8.2.5155: in diff mode windows may get out of sync
Problem:    In diff mode windows may get out of sync. (Gary Johnson)
Solution:   Avoid that the other window scrolls for 'cursorbind'.
a315ce1f32
2022-07-25 20:30:35 +08:00
zeertzjq
0cc41a61d1 test: improve some input tests 2022-07-25 09:47:28 +08:00
zeertzjq
eb77122823 fix(input): do no reinterpret mouse keys with ALT modifiers
Remove check for MOD_MASK_META as it is for <T- which never appears in TUI.
Make small changes to docs.
2022-07-25 09:47:28 +08:00
notomo
46e3e1c728
fix(api): make nvim_cmd mods.silent work correctly (#19489) 2022-07-25 09:43:39 +08:00
zeertzjq
ea13dce3bf
fix(mouse): fix using uninitialized memory with K_MOUSEMOVE (#19480)
Fix a mistake in the porting of Vim patch 8.0.1309.
2022-07-24 09:29:28 +08:00
zeertzjq
bb7853a62d
test(mksession_spec): use %bwipeout! instead of qall! to close terminal (#19465)
Avoid expect_exit, session will be closed when a new one is spawned.
2022-07-22 12:59:34 +08:00
zeertzjq
8af3d641da
fix(grid): don't use utfc_ptr2char_len() when printing until NUL (#19456) 2022-07-22 06:41:51 +08:00
zeertzjq
c15e9d3746
fix(mark): give correct error message when mark is in another buffer (#19454) 2022-07-21 17:42:17 +08:00
bfredl
598cbcae4a
Merge pull request #19445 from famiu/fix/local_winbar_tabs
fix: local winbar with tabs
2022-07-20 16:57:38 +02:00
Famiu Haque
9879fd5d08 fix: local winbar with tabs
Closes #19396
2022-07-20 20:32:22 +06:00
Lewis Russell
559ef3e903
feat(lua): allow vim.cmd to be indexed (#19238) 2022-07-20 12:29:24 +01:00
zeertzjq
72dfd57e5f test: deal with RPC call causing Nvim to exit later 2022-07-19 19:41:07 +08:00
zeertzjq
366e90cdc8 test: avoid timing-sensitive undo message 2022-07-19 19:41:07 +08:00
bfredl
101fd04ee2
Merge pull request #19409 from bfredl/uiunpack
perf(ui): some ui_client fixes/optimizations before externalized TUI
2022-07-19 13:08:11 +02:00
zeertzjq
7b835ba796
vim-patch:8.2.1147 (#19425)
vim-patch:8.2.1147: :confirm may happen in cooked mode

Problem:    :confirm may happen in cooked mode. (Jason Franklin)
Solution:   Switch to raw mode before prompting. (Brandon Pfeifer)
27321dbeed

Code is N/A, but this improves tests. Port the improved tests to Lua.
2022-07-19 13:00:22 +08:00
JP
1a655b71a8
fix(lua): make it possible to cancel vim.wait() with Ctrl-C (#19217) 2022-07-19 09:11:13 +08:00
Munif Tanjim
a80d447b47
fix(mouse): click on global statusline with splits (#19390) 2022-07-19 06:35:04 +08:00
Enan Ajmain
3340728c72
fix(powershell): filter ":!" commands with args #19268
Problem:
Since 0b9664f524 powershell filtered
:[range]! commands with args causes error:
"Start-Process: A positional parameter cannot be found that accepts argument ..."

Solution:
Pass args to Start-Process via `-ArgumentList`.
closes #19250
2022-07-18 13:26:09 -07:00
bfredl
be3d2f5125 perf(ui): avoid ui_flush() work in headless mode 2022-07-18 14:08:44 +02:00
bfredl
45bee1dafd perf(ui): eliminate spurious memory allocations for hl_attr_define event 2022-07-18 14:08:44 +02:00
Enan Ajmain
1b462705d0
fix(windows):exepath, stdpath return wrong slashes #19111
exepath and stdpath should respect shellslash and return path with
proper file separator.
Closes #13787
2022-07-17 17:00:08 -07:00
ii14
13abe20b5f
refactor(lsp): use autocmd api (#19407)
* refactor(lsp): use autocmd api

* refactor(lsp): inline BufWritePost and VimLeavePre callbacks
2022-07-17 19:13:33 +02:00
matveyt
eb9b93b5e0
feat(defaults): mouse=nvi #19290
Problem:
Since right-click can now show a popup menu, we can provide messaging to
guide users who expect 'mouse' to be disabled by default. So 'mouse' can
now be enabled by default.

Solution:
Do it.
Closes #15521
2022-07-17 04:14:04 -07:00
zeertzjq
9f837a5dcf
fix(api): fix nvim_parse_cmd interfere with printing line in Ex mode (#19400) 2022-07-17 09:59:32 +08:00
James McCoy
08a50f6690
Merge pull request #19395 from jamessan/flaky-job-test
test(job_spec): accept alternate messages for "append environment" tests
2022-07-16 21:24:06 -04:00
James McCoy
bcb5b7b3f6
test(job_spec): accept alternate messages for "append environment" tests
These tests commonly fail in Debian with

    [  ERROR   ] test/functional/core/job_spec.lua @ 81: jobs append environment with pty #env
    test/functional/helpers.lua:198:
    ==============================================================================
    test/helpers.lua:73: Expected objects to be the same.
    Passed in:
    (table: 0x2aa4bcc1040) {
     *[1] = {
        [1] = 'notification'
        [2] = 'stdout'
       *[3] = {
          [1] = 0
         *[2] = {
            [1] = 'hello world abc' } } } }
    Expected:
    (table: 0x2aa4bcc0d70) {
     *[1] = {
        [1] = 'notification'
        [2] = 'stdout'
       *[3] = {
          [1] = 0
         *[2] = {
            [1] = 'hello world abc'
           *[2] = '' } } } }

Since the test is validating the "hello world abc" message, not the
newlines, accept either set of message sequences.
2022-07-16 14:08:27 -04:00
zeertzjq
0cfd4fa8f3 vim-patch:8.2.2643: various code not covered by tests
Problem:    Various code not covered by tests.
Solution:   Add a few more test. (Yegappan Lakshmanan, closes vim/vim#7995)
1f448d906b

Cherry-pick some test_edit.vim changes from patches 8.2.{1022,1432}.
Reorder test_undo.vim to match upstream.
2022-07-16 22:46:54 +08:00
zeertzjq
780edfc0eb vim-patch:8.2.2608: character input not fully tested
Problem:    Character input not fully tested.
Solution:   Add more tests. (Yegappan Lakshmanan, closes vim/vim#7963)
f4fcedc59d

Cherry-pick related changes from patches 8.2.{0433,0866}.
2022-07-16 21:55:27 +08:00
zeertzjq
bc73795a58 vim-patch:8.2.0198: no tests for y/n prompt
Problem:    No tests for y/n prompt.
Solution:   Add tests. (Dominique Pelle, closes vim/vim#5564)
43c60eda2a
2022-07-16 21:32:25 +08:00
zeertzjq
f7c6676199 vim-patch:8.2.0052: more-prompt not properly tested
Problem:    More-prompt not properly tested.
Solution:   Add a test case. (Dominique Pelle, closes vim/vim#5404)
c6d539b671
2022-07-16 21:32:25 +08:00
zeertzjq
711a6a9157
fix(ex_cmds): correct flags for :const (#19387) 2022-07-16 14:54:31 +08:00
zeertzjq
73526abbbd
fix(api): do not switch win/buf if getting option in current win/buf (#19383) 2022-07-16 09:31:05 +08:00
zeertzjq
33da7d83e8
fix(pum): make right drag in anchor grid to select work in multigrid UI (#19382) 2022-07-16 08:26:40 +08:00
Natasha England-Elbro
86f0da922f
fix: remote UI may get invalid 'pumblend' value #19379
fixes: https://github.com/neovim/neovim/issues/19340
2022-07-15 10:42:01 -07:00
Famiu Haque
6645f59832
fix: right-click in clickable statusline #19252
Problem:
1. Right-click does not work in statusline unless you left-click first (to focus
   the statusline).
2. Modifier (e.g. shift+rightclick) does not work in statusline.

Solution:
Make clickable statusline sections receive right-clicks regardless of whether
the statusline is focused.

Closes #18994
2022-07-15 09:15:02 -07:00
zeertzjq
827906136d test: improve searchhl tests 2022-07-15 19:38:13 +08:00
zeertzjq
465b73c3a5 vim-patch:8.2.0482: channel and sandbox code not sufficiently tested
Problem:    Channel and sandbox code not sufficiently tested.
Solution:   Add more tests. (Yegappan Lakshmanan, closes vim/vim#5855)
ca68ae1311

Cherry-pick test_clientserver.vim changes form patch 8.2.0448.
2022-07-15 10:50:21 +08:00
zeertzjq
8730643326 fix(winbar): make setting WinBar and WinBarNC in 'winhighlight' work 2022-07-15 09:22:57 +08:00
zeertzjq
b93cb481a2
feat(eval)!: input() support any type for "cancelreturn" in a dict (#19357) 2022-07-14 14:47:25 +08:00
zeertzjq
c01690b1ea
fix(exmode): flush messages before printing a line after pressing Enter (#19341) 2022-07-13 09:06:31 +08:00
zeertzjq
4aa4675fbf vim-patch:8.2.0293: various Ex commands not sufficiently tested
Problem:    Various Ex commands not sufficiently tested.
Solution:   Add more test cases. (Yegappan Lakshmanan, closes vim/vim#5673)
818fc9ad14

Needs to assert E170 instead of E580 because patch 8.2.3486 has been
ported but patch 8.2.1183 hasn't.
2022-07-12 16:23:32 +08:00
zeertzjq
01afd43bc9 vim-patch:8.2.0275: some Ex code not covered by tests
Problem:    Some Ex code not covered by tests.
Solution:   Add test cases. (Yegappan Lakshmanan, closes vim/vim#5659)
406cd90f19
2022-07-12 16:23:32 +08:00
zeertzjq
1abdb3224b vim-patch:8.2.2732: prompt for s///c in Ex mode can be wrong
Problem:    Prompt for s///c in Ex mode can be wrong.
Solution:   Position the cursor before showing the prompt. (closes vim/vim#8073)
e5b0b98a90
2022-07-12 14:08:34 +08:00
zeertzjq
d079995fb8 vim-patch:8.2.0270: some code not covered by tests
Problem:    Some code not covered by tests.
Solution:   Add test cases. (Yegappan Lakshmanan, closes vim/vim#5649)
bc2b71d44a
2022-07-12 14:08:34 +08:00
zeertzjq
53392f48b1 vim-patch:8.2.0203: :helptags and some other functionality not tested
Problem:    :helptags and some other functionality not tested.
Solution:   Add more tests. (Yegappan Lakshmanan, closes vim/vim#5567)
e20b9ececa
2022-07-12 11:52:47 +08:00
zeertzjq
27fd17a79c vim-patch:8.2.0243: insufficient code coverage for ex_docmd.c functions
Problem:    Insufficient code coverage for ex_docmd.c functions.
Solution:   Add more tests. (Yegappan Lakshmanan, closes vim/vim#5618)
9f6277bdde

Cherry-pick Test_window_only() from patch 8.2.0203.
Cherry-pick a memory leak fix from patch 8.2.0399.
2022-07-12 05:36:33 +08:00
zeertzjq
5105f713bd test(float_spec): make indent more consistent 2022-07-10 17:24:29 +08:00
zeertzjq
63f6ecd419 fix(float): fix mouse drag position if float window turned to a split 2022-07-10 17:24:29 +08:00
zeertzjq
63f63dd2b7 fix(float): fix glitch when making float window with border a split 2022-07-10 17:24:29 +08:00
zeertzjq
99e8298711 fix(float): fix float window with winbar cannot have screen height 2022-07-10 17:24:29 +08:00
zeertzjq
f7d6f472f7 fix(float): fix float window border drawing with winbar 2022-07-10 17:24:29 +08:00
Justin M. Keyes
eb9155e557
Merge #19267 require() in --startuptime 2022-07-10 01:04:11 +02:00
Justin M. Keyes
797007997c test: --startuptime 2022-07-09 15:45:02 -07:00
zeertzjq
a6803f3adf test: add a test for what Vim patch 8.2.0151 fixes 2022-07-08 14:18:16 +08:00
zeertzjq
4cded8cec1
Merge pull request #19180 from zeertzjq/tui-kitty-keypad
feat(tui): recognize keypad keys when using kitty keyboard protocol
2022-07-07 07:42:22 +08:00
zeertzjq
664efa497e
vim-patch:8.2.0614: get ml_get error when deleting a line in 'completefunc' (#19244)
Problem:    Get ml_get error when deleting a line in 'completefunc'. (Yegappan
            Lakshmanan)
Solution:   Lock the text while evaluating 'completefunc'.
ff06f283e3

Fix a mistake in the porting of patch 8.1.0098.
Cherry-pick Test_run_excmd_with_text_locked() from patch 8.2.0270.
Cherry-pick test_gf.vim changes from patch 8.2.0369.
Cherry-pick message change from later patches.
2022-07-07 04:47:18 +08:00
Jay
93c8fe77cb
feat: add 'mousescroll' option (#12355)
Add 'mousescroll' option to control how many lines to scroll by when a
mouse wheel keycode is received. The mousescroll option controls both
horizontal and vertical scrolling. The option is a string in the format:

    set mousescroll=direction:count,direction:count

Where direction is either "ver" or "hor", and count is a non negative
integer. If a direction is omitted, a default value is used. The default
values remain unchanged, that is 3 for vertical scrolling, and 6 for
horizontal scrolling. As such, the mousescroll default is "ver:3,hor:6".

Add mousescroll documentation
 - Add option documentation in options.txt
 - Add brief summary in quickref.txt

Update :help scroll-mouse-wheel
 - Mention mousescroll option as a means of controlling scrolling.
 - Remove obsolete suggestion to map scroll wheel keys to <C-U> to
   scroll by a single line -- users should prefer the mousescroll option.
 - Add some information about the consequences of remapping scroll wheel
   keys (they lose their magic ability to affect inactive windows).

Update :help vim-differences
 - Add brief mousescroll summary under Options

Add mousescroll tests
 - Test option validation
 - Test default mousescroll value and behavior
 - Test fallback to default values
 - Test mouse vertical and horizontal scrolling in normal mode
 - Test mouse vertical and horizontal scrolling in insert mode
2022-07-06 19:34:24 +08:00
zeertzjq
9ced054134
fix(mark): fix unexpected cursor movements (#19253) 2022-07-06 19:01:44 +08:00
Justin M. Keyes
d0835617fa
fix(terminal): crash if TermClose deletes own buffer #19222
- Partially fixes #10386 except for the case where the alternate buffer
  is the default, empty, first buffer created on startup. #vimlife
- TODO: port patches related to `can_unload_buffer`, maybe that fully
  fixes #10386?

vim-patch:8.0.1732: crash when terminal API call deletes the buffer
2022-07-05 02:31:49 -07:00
zeertzjq
826fe56f5c
fix(mark): mark without a view restores at topline #19224
For a local mark without a view, currently trying to restore its view
will put the cursor at topline, which is not the correct behavior.
Initialize `topline_offset` to `MAXLNUM` instead to fix this.
2022-07-04 13:28:14 -07:00
Javier Lopez
1803b0ffd7
fix(tui): resize at startup #17795
* fix(test): screen.lua nil index
  When actual_rows and expected_rows are different avoid a nil index.
* fix(tui): resize at startup
  The deleted code is not needed after 402b4e8.
  It caused the condition to false positive when the function was called
  more than once before startup (first normal mode). Being itself what
  set the dimension and not the user, locking the size of the screen to
  an incorrect size.
  Make got_winch an int to mitigate: tui_grid_resize changing the size
  of the host terminal between the signal handler and the call to
  sigwinch_cb. Since the actual signal handler uv__signal_handle doesn't
  directly call the callback, the event loop does.

Fixes #17285
Fixes #15044
Fixes #11330
2022-07-04 13:09:47 -07:00
zeertzjq
03c9cf3feb test: add tests for keypad keys from kitty keyboard protocol 2022-07-04 22:37:45 +08:00
zeertzjq
7a907c3314 feat(api): add unsilent to command APIs 2022-07-03 04:34:28 +08:00
zeertzjq
5a62ad605e feat(ui): make right-click menu work properly with ext_multigrid
Add tests both with and without ext_multigrid.
2022-07-01 10:28:07 +08:00
zeertzjq
610cf9f950 vim-patch:8.0.1570: can't use :popup for a menu in the terminal
Problem:    Can't use :popup for a menu in the terminal. (Wei Zhang)
Solution:   Make :popup work in the terminal.  Also fix that entries were
            included that don't work in the current state.
29a2c08d79
2022-07-01 10:17:39 +08:00
Shougo
5a490d838e
cmdheight=0: fix bugs #18961
Continue of #16251

Fix #18953
Fix #18960
Fix #18958
Fix #18955
Fix #18970
Fix #18983
Fix #18995
Fix #19112
2022-06-30 18:59:50 -07:00
Javier Lopez
565f72b968
feat(marks): restore viewport on jump #15831
** Refactor

Previously most functions used to "get" a mark returned a position,
changed the line number and sometimes changed even the current buffer.

Now functions return a {x}fmark_T making calling context aware whether
the mark is in another buffer without arcane casting. A new function is
provided for switching to the mark buffer and returning a flag style
Enum to convey what happen in the movement. If the cursor changed, line,
columns, if it changed buffer, etc.

The function to get named mark was split into multiple functions.

- mark_get() -> fmark_T
- mark_get_global() -> xfmark_T
- mark_get_local() -> fmark_T
  - mark_get_motion() -> fmark_T
  - mark_get_visual() -> fmark_T

Functions that manage the changelist and jumplist were also modified to
return mark types.

- get_jumplist -> fmark_T
- get_changelist -> fmark_T

The refactor is also seen mainly on normal.c, where all the mark
movement has been siphoned through one function nv_gomark, while the
other functions handle getting the mark and setting their movement
flags. To handle whether context marks should be left, etc.

** Mark View

While doing the refactor the concept of a mark view was also
implemented:

The view of a mark currently implemented as the number of lines between
the mark position on creation and the window topline. This allows for
moving not only back to the position of a mark but having the window
look similar to when the mark was defined. This is done by carrying and
extra element in the fmark_T struct, which can be extended later to also
restore horizontal shift.

*** User space features

1. There's a new option, jumpoptions+=view enables the mark view restoring
automatically when using the jumplist, changelist, alternate-file and
mark motions. <C-O> <C-I> g; g, <C-^> '[mark] `[mark]

** Limitations

- The view information is not saved in shada.
- Calls to get_mark should copy the value in the pointer since we are
  using pos_to_mark() to wrap and provide a homogeneous interfaces. This
  was also a limitation in the previous state of things.
2022-06-30 05:59:52 -07:00
Justin M. Keyes
f50135a32e
feat: stdpath('run'), /tmp/nvim.user/ #18993
Problem:
- Since c57f6b28d7 #8519, sockets are created in ~/.local/… but XDG
  spec says: "XDG_RUNTIME_DIR: Must be on the local filesystem", which
  implies that XDG_STATE_DIR is potentially non-local.
- Not easy to inspect Nvim-created temp files (for debugging etc).

Solution:
- Store sockets in stdpath('run') ($XDG_RUNTIME_DIR).
- Establish "/tmp/nvim.user/" as the tempdir root shared by all Nvims.
- Make ok() actually useful.
- Introduce assert_nolog().

closes #3517
closes #17093
2022-06-30 04:16:46 -07:00
zeertzjq
995e487915
refactor(highlight)!: rename attributes to match Vim (#19159)
Ref: 84f5463630
Rename:
- `underlineline` to `underdouble`
- `underdot` to `underdotted`
- `underdash` to `underdashed`

`underdouble` also now takes higher precedence than `undercurl`.
2022-06-30 16:57:44 +08:00
L3MON4D3
6f6286e4f9
fix(lsp): small bugs in snippet-parser #18998
This fixes the following bugs:
`${1:else_text}` -> format with if_text: "else_text"
`${1:-else_text}` -> format with if_text: "else_text"
`${1:}` in `format` (eg. empty else_text) -> error.
`${1:}` (eg. empty placeholder) -> error.

Thanks hrsh7th :)
2022-06-29 09:53:49 -07:00
zeertzjq
8ea09fc908
vim-patch:8.2.4378: incsearch HL broken when calling searchcount in 'tabLine' (#19147)
Problem:    Incsearch highlight broken when calling searchcount() in 'tabLine'
            function. (Mirko Palmer)
Solution:   Save and restore the incsearch state. (Christian Brabandt,
            closes vim/vim#9763, closes vim/vim#9633)
6dd7424c7e
2022-06-29 19:34:37 +08:00
bfredl
21a1f1f552
Merge pull request #19133 from famiu/feat/api/cmd_support_filter
feat(api): make `nvim_parse_cmd` and `nvim_cmd` support :filter
2022-06-29 09:12:01 +02:00
bfredl
7ab2e12ebc refactor(aucmd): call define_autocmd() directly for default autocmds 2022-06-28 23:41:46 +02:00
Famiu Haque
606ec8b708 feat(api): make nvim_parse_cmd and nvim_cmd support :filter
Also fixes a memory leak in `parse_cmdline`.

Closes #18954.
2022-06-28 17:31:04 +06:00
Justin M. Keyes
f05a2891d3 build: rename build-related dirs
Problem:
Dirs "config", "packaging", and "third-party" are all closely related
but this is not obvious from the layout. This adds friction for new
contributors.

Solution:
- rename config/ to cmake.config/
- rename test/config/ to test/cmakeconfig/ because it is used in Lua
  tests: require('test.cmakeconfig.paths').
- rename packaging/ to cmake.packaging/
- rename third-party/ to cmake.deps/ (parallel with .deps/)
2022-06-28 04:02:29 -07:00
Justin M. Keyes
094086a713
Merge #19060 memory leaks 2022-06-28 12:37:39 +02:00
0x74696d6d79
ee6b21e843
fix(vim.ui.input): accept nil or empty "opts" #19109
Fix #18143
2022-06-28 02:53:15 -07:00
Famiu Haque
7e1cf6b764
fix(inccommand): parse the command to check if it is previewable
Free regprog if command isn't previewable

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2022-06-28 13:00:05 +08:00
zeertzjq
cf23695dd7
fix(api): nvim_parse_cmd check for ambiguous user command (#19116) 2022-06-27 14:10:13 +08:00
Justin M. Keyes
e2f9d0332b
test: use "python3" to avoid skipped test #19106
Problem:
The "calls executable in $PATH" is skipped on some CI jobs because
"python" is not found.

Solution:
Use "python3" instead.
2022-06-26 22:03:06 -07:00
Thomas Vigouroux
89f75dcd1f
fix(coverity/348300): free memory when overiding sing attribute
Nothing prevent the user from doing `:sign define abc culhl=Normal
culhl=Normal` and thus this leads to an obvious memory leak.
2022-06-27 06:55:41 +02:00
Christian Clason
516d6318b7
Merge pull request #19091 from clason/do-aucmd-pats
feat(api): support pattern array for exec_autocmds
2022-06-26 23:05:52 +02:00
Gregory Anders
f3ce06cfa1
refactor(filetype)!: allow vim.filetype.match to use different strategies (#18895)
This enables vim.filetype.match to match based on a buffer (most
accurate) or simply a filename or file contents, which are less accurate
but may still be useful for some scenarios.

When matching based on a buffer, the buffer's name and contents are both
used to do full filetype matching. When using a filename, if the file
exists the file is loaded into a buffer and full filetype detection is
performed. If the file does not exist then filetype matching is only
performed against the filename itself. Content-based matching does the
equivalent of scripts.vim, and matches solely based on file contents
without any information from the name of the file itself (e.g. for
shebangs).

BREAKING CHANGE: use `vim.filetype.match({buf = bufnr})` instead 
of `vim.filetype.match(name, bufnr)`
2022-06-26 18:41:20 +02:00
Christian Clason
da358d4521 feat(api): support pattern array for exec_autocmds 2022-06-26 13:04:45 +02:00
Justin M. Keyes
f977f9445f refactor(tests): introduce testprg()
Also:
- Add a describe('shell :!') section to system_spec.
- Make the test for #16271 work on systems without powershell.
2022-06-25 08:27:17 -07:00
Enan Ajmain
0b9664f524 fix: make_filter_cmd for :! powershell #15913
Problem:
Nvim fails to create tempfile "…/nvim6UJx04/7" when 'shell' is set to
pwsh (PowerShell Core). This breaks filtered shell commands ":{range}!".
With shell set to cmd, it works.

Solution:
PowerShell doesn't use "<" for stdin redirection. Instead, use
"-RedirectStandardInput".

Closes #15913
2022-06-25 07:20:58 -07:00
bfredl
88a5941598
Merge pull request #19041 from lewis6991/globallocal
fix(api): nvim_set_option_value for global-local options
2022-06-25 11:09:55 +02:00
zeertzjq
3c85fd817e
fix(api): check for inclusive buffer line index out of bounds correctly (#19056) 2022-06-23 21:38:00 +08:00
bfredl
a3ce03bef1
Merge pull request #19020 from echasnovski/screenchar-float
fix(float): make `screen*()` functions respect floating windows
2022-06-23 12:01:27 +02:00
Evgeni Chasnovski
9f28eddfab
fix(float): make screen*() functions respect floating windows
Resolves #19013.
2022-06-23 10:34:02 +03:00
zeertzjq
801faeaae2
fix(input): use correct grid when restoring cursor for <expr> mapping (#19047) 2022-06-23 06:04:03 +08:00
Gregory Anders
c94325288a
fix(api): check error after getting win/buf handle (#19052) 2022-06-22 13:19:03 -06:00
Justin M. Keyes
b20b28249b
fix(build): only pass -municode if MINGW #19049
Avoids this warning in the Windows build:

    2022-06-22T08:58:13.0542153Z LINK : warning LNK4044: unrecognized option '/municode'; ignored [D:\a\neovim\neovim\build\test\functional\fixtures\printenv-test.vcxproj]
2022-06-22 07:09:19 -07:00
Lewis Russell
d23465534a fix(api): nvim_set_option_value for global-local options
global-local window options need to be handled specially. When `win` is
given but `scope` is not, then we want to set the local version of the
option but not the global one, therefore we need to force
`scope='local'`.

Note this does not apply to window-local only options (e.g. 'number')

Example:

   nvim_set_option_value('scrolloff', 10, {})       -- global-local window option; set global value
   nvim_set_option_value('scrolloff', 20, {win=0})  -- global-local window option; set local value
   nvim_set_option_value('number', true, {})        -- local window option

is now equivalent to:

   nvim_set_option_value('scrolloff', 10, {})
   nvim_set_option_value('scrolloff', 20, {win=0, scope='local'})  -- changed from before
   nvim_set_option_value('number', true, {win=0})                  -- unchanged from before

Only the global-local option with a `win` provided gets forced to local
scope.
2022-06-22 11:08:30 +01:00
bfredl
374e0b6678 perf(highlight): don't allocate duplicates for color names 2022-06-21 18:40:33 +02:00
Gregory Anders
6d52a29c3b
Merge pull request #18743 from gpanders/bowooptvalue
Add "buf" and "win" to nvim_get_option_value and use them in vim.bo and vim.wo
2022-06-20 17:28:37 -06:00
Gregory Anders
87a68b6a3a refactor: use nvim_{get,set}_option_value for vim.{b,w}o
`nvim_get_option_value` and `nvim_set_option_value` better handle
unsetting local options. For instance, this is currently not possible:

    vim.bo.tagfunc = nil

This does not work because 'tagfunc' is marked as "local to buffer" and
does not have a fallback global option. However, using :setlocal *does*
work as expected

    :setlocal tagfunc=

`nvim_set_option_value` behaves more like :set and :setlocal (by
design), so using these as the underlying API functions beneath vim.bo
and vim.wo makes those two tables act more like :setlocal. Note that
vim.o *already* uses `nvim_set_option_value` under the hood, so that
vim.o behaves like :set.
2022-06-20 09:16:21 -06:00
Gregory Anders
58d028f64b feat(api): add "buf" and "win" to nvim_get_option_value
These mirror their counterparts in nvim_set_option_value.
2022-06-20 09:16:21 -06:00
bfredl
5d69872105 perf(ui): reduce allocation overhead when encoding "redraw" events
Note for external UIs: Nvim can now emit multiple "redraw" event batches
before a final "flush" event is received. To retain existing behavior,
clients should make sure to update visible state at an explicit "flush"
event, not just the end of a "redraw" batch of event.

* Get rid of copy_object() blizzard in the auto-generated ui_event layer
* Special case "grid_line" by encoding screen state directly to
  msgpack events with no intermediate API events.
* Get rid of the arcane notion of referring to the screen as the "shell"
* Array and Dictionary are kvec_t:s, so define them as such.
* Allow kvec_t:s, such as Arrays and Dictionaries, to be allocated with
  a predetermined size within an arena.
* Eliminate redundant capacity checking when filling such kvec_t:s
  with values.
2022-06-20 12:44:56 +02:00
ii14
a195dc7c83
fix(decorations): nvim_buf_set_extmark breaks conceal #19010
Closes #19007

Co-authored-by: bfredl <bjorn.linse@gmail.com>
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2022-06-19 10:33:54 -07:00
Justin M. Keyes
7b2b44bce4
fix(ci): noisy logs, unreliable test #19019
Problem:
1. CI logs have too many (40+) logs mentioning SIGHUP:
   ```
   WRN 2022-06-18T16:05:47.075 T3568.22499.0/c deadly_signal:177: got signal 1 (SIGHUP)
   WRN 2022-06-18T16:05:47.273 T3569.91095.0/c deadly_signal:177: got signal 1 (SIGHUP)
   WRN 2022-06-18T16:05:47.651 T3570.59545.0/c deadly_signal:177: got signal 1 (SIGHUP)
   ```
2. TS parser test still sometimes fails on BSD CI.
3. remote_spec test fails too often.

Solution:
1. Log deadly signals at INFO level. It hasn't been helpful in CI, and
   for local troubleshooting it's reasonable to adjust the loglevel as
   needed.
2. Adjust the TS parser test again. ref #18911
3. Skip the remote_spec test. The `--remote` feature was merged before
   it was fully formed and needs to be revisited.
2022-06-18 19:19:08 -07:00
Oliver Marriott
98e2da7d50
fix(hl): return cterm fg/bg even if they match Normal #18981
Fixes #18980

- 831fa45ad8 is related but this doesn't regress that
- The `cterm_normal_fg_color != ae.cterm_fg_color` comparison is originally
  carried from patch to patch starting all the way back in 29bc6dfabd where it
  was avoiding setting a HL attr. But `hlattrs2dict()` now is just
  informational.
2022-06-16 18:33:58 -07:00
Justin M. Keyes
c57f6b28d7
Merge #8519 feat: name, test ids, sockets in stdpath(state) 2022-06-17 01:23:48 +02:00
zeertzjq
179faa3edd
fix(lua): clear got_int when calling vim.on_key() callback (#18979) 2022-06-16 18:51:36 +08:00
notomo
0e8186bdd8
fix(lua): highlight.on_yank can close timer in twice #18976
Steps to reproduce:

1. setting `vim.highlight.on_yank`
   ```
   vim.api.nvim_create_autocmd({ "TextYankPost" }, {
     pattern = { "*" },
     callback = function()
       vim.highlight.on_yank({ timeout = 200 })
     end,
   })
   ```
2. repeat typing `yeye` ...
3. causes the following error.
   ```
   Error executing vim.schedule lua callback: vim/_editor.lua:0: handle 0x01e96970 is already closing
   stack traceback:
           [C]: in function 'close'
           vim/_editor.lua: in function ''
           vim/_editor.lua: in function <vim/_editor.lua:0>
   ```

📝 Test result before fix:

    [----------] Global test environment setup.
    [----------] Running tests from test/functional/lua/highlight_spec.lua
    [ RUN      ] vim.highlight.on_yank does not show errors even if buffer is wiped before timeout: 15.07 ms OK
    [ RUN      ] vim.highlight.on_yank does not show errors even if executed between timeout and clearing highlight: 15.07 ms ERR
    test/helpers.lua:73: Expected objects to be the same.
    Passed in:
    (string) 'Error executing vim.schedule lua callback: vim/_editor.lua:0: handle 0x02025260 is already closing
    stack traceback:
            [C]: in function 'close'
            vim/_editor.lua: in function ''
            vim/_editor.lua: in function <vim/_editor.lua:0>'
    Expected:
    (string) ''
2022-06-15 19:39:55 -07:00
Justin M. Keyes
1f2c2a35ad feat(server): instance "name", store pipes in stdpath(state)
Problem:
- Unix sockets are created in random /tmp dirs.
  - /tmp is messy, unclear when OSes actually clear it.
  - The generated paths are very ugly. This adds friction to reasoning
    about which paths belong to which Nvim instances.
- No way to provide a human-friendly way to identify Nvim instances in
  logs or server addresses.

Solution:
- Store unix sockets in stdpath('state')
- Allow --listen "name" and serverstart("name") to given a name (which
  is appended to a generated path).

TODO:
- is stdpath(state) the right place?
2022-06-15 19:29:51 -07:00
Justin M. Keyes
b6467dfc23 test(report): formatting, drop dumplog()
Don't need to dumplog() on each failed test because we now have test-ids
that associate log messages with tests.
2022-06-15 19:23:10 -07:00
Justin M. Keyes
8f06520594 feat(logging): include test-id in log messages
Problem:
1. Log messages (especially in CI) are hard to correlate with tests.
2. Since b353a5c05f #11886, dumplog() prints the logs next to test
   failures. This is noisy and gets in the way of the test results.

Solution:
1. Associate an incrementing id with each test and include it in log
   messages.
    - FUTURE: add v:name so Nvim instances can be formally "named"?
2. Mention "child" in log messages if the current Nvim is a child (based
   on the presence of $NVIM).

BEFORE:

    DBG … 12345      UI: event
    DBG … 12345      log_server_msg:722: RPC ->ch 1: …
    DBG … 12345      UI: flush
    DBG … 12345      inbuf_poll:444: blocking... events_enabled=1 events_pending=0
    DBG … 23454      UI: stop
    INF … 23454      os_exit:594: Nvim exit: 0

AFTER:

    DBG … T57        UI: event
    DBG … T57        log_server_msg:722: RPC ->ch 1: …
    DBG … T57        UI: flush
    DBG … T57        inbuf_poll:444: blocking... events_enabled=1 events_pending=0
    DBG … T57/child  UI: stop
    INF … T57/child  os_exit:594: Nvim exit: 0
2022-06-15 19:23:10 -07:00
zeertzjq
0c6ad03c3f
fix(ui): do not call showmode() when setting window height (#18969) 2022-06-15 19:41:58 +08:00
zeertzjq
1493efdc14
test: correct check for v:errmsg in inccommand test (#18968)
After the first separator is typed v:errmsg can be set.
Check for its value before typing the first separator.
2022-06-15 10:18:43 +08:00
zeertzjq
619eb32c75
fix(inccommand): never preview if parsing command failed (#18944)
`errormsg` is not always set when parsing the command failed (e.g. when
the range contains invalid marks). Check the return value is better.
2022-06-14 10:55:04 +08:00
kylo252
837360868b
fix(tests): missing clear() #18927
This was caught in #18674 since it allows test isolation
2022-06-13 04:05:17 -07:00
Shougo
663cbe2620
feat: cmdheight=0 #16251
Fix https://github.com/neovim/neovim/issues/1004

Limitation: All outputs need hit-enter prompt.

Related:
https://github.com/neovim/neovim/pull/6732
https://github.com/neovim/neovim/pull/4382
2022-06-13 02:40:51 -07:00
bfredl
e3281d992e fix(tests): check for EOF on exit of nvim properly 2022-06-13 10:15:44 +02:00
Daniel Hahler
e420cd6c67
test: dismiss quit_more from Lua #11226
Add a test for what #16537 fixed.
2022-06-12 16:45:44 -07:00
zeertzjq
c665773897
Merge pull request #18931 from zeertzjq/regexp-num-escaped
fix(substitute): subtract number of backslashes later
2022-06-13 07:18:38 +08:00
zeertzjq
429c40cce3
fix(buffer): disable buffer-updates before removing from window #18933
There can be other places that access window buffer info (e.g.
`tabpagebuflist()`), so checking `w_closing` in `win_findbuf()` doesn't
solve the crash in all cases, and may also cause Nvim's behavior to
diverge from Vim.

Fix #14998
2022-06-12 15:02:00 -07:00
Famiu Haque
2de0d67144
fix(inccommand): skip split window if not enough room #18937
Command preview now behaves like inccommand=nosplit when there's not
enough room for the preview window to be opened instead of aborting,
which is consistent with old behavior of 'inccommand'.
2022-06-12 10:59:04 -07:00
zeertzjq
41bb81a2df fix(substitute): subtract number of backslashes later 2022-06-12 20:42:30 +08:00
bfredl
f4121c52b9 fix(messages): add color when showing nvim_echo in :messages history 2022-06-11 22:29:51 +02:00
zeertzjq
2b539d6fdf
fix(inccommand): clear cmdpreview state if preview is not shown (#18923) 2022-06-11 13:04:19 +08:00
zeertzjq
e15d31b530
fix(input): fix macro recording with ALT and special key (#18917) 2022-06-10 17:13:57 +08:00
Gregory Anders
58323b1fe2
feat(filetype): remove side effects from vim.filetype.match (#18894)
Many filetypes from filetype.vim set buffer-local variables, meaning
vim.filetype.match cannot be used without side effects. Instead of
setting these buffer-local variables in the filetype detection functions
themselves, have vim.filetype.match return an optional function value
that, when called, sets these variables. This allows vim.filetype.match
to work without side effects.
2022-06-09 13:12:36 -06:00
Justin M. Keyes
9662cd7f48
fix(tests): unreliable parser_spec #18911
The "first run" has high variability. Looks like the test failures
correlate with 545dc82c1b
, which makes sense because that improves "first run" performance.

So the `1000*` factor of this test could be adjusted to e.g. `300*` or `500*`.

ref https://github.com/neovim/neovim/pull/16945
2022-06-09 08:07:54 -07:00
kylo252
3da3cfc864
feat(autocmds): retrieve lua callback (#18642)
add a new `callback` field to `nvim_get_autocmds`
2022-06-09 07:18:56 -06:00
James McCoy
a4e1b76f55
test: allow running CI without ts parsers installed 2022-06-08 21:10:49 -04:00
James McCoy
8a70c53dad
Merge pull request #18903 from jamessan/skip-test-parsers
test(ts): skip test if C parser is not available
2022-06-08 21:10:01 -04:00
Javier Lopez
916d848049
fix(terminal): scrollback delete lines immediately #18832
* on_scrollback_option_changed renamed to adjust_scrollback. The
  function name did not correspond to what it was doing. It is
  called unconditionally in every refresh of the terminal
  unrelated if the scrollback option was changed.
* new on_scrollback_option_changed function, which calls
  refresh_terminal, which then calls adjust_scrollback
* terminal_check_size is not the appropriate function to call when the
  option is changed since it only conditionally adjusts the scrollback.
  Use the new on_scrollback_option_changed

fixes #15477
fixes #11811
2022-06-08 17:46:57 -07:00
James McCoy
6b0595d7cc
test(ts): skip test if C parser is not available 2022-06-08 18:04:25 -04:00
mohsen
94181ad7dc
fix(diagnostic): check for negative column value (#18868) 2022-06-08 12:55:39 -06:00
Famiu Haque
c84bd9e21f fix(nvim_create_user_command): make smods work with nvim_cmd
Closes #18876.
2022-06-08 15:24:52 +06:00
zbirenbaum
df70a3abcd fix(highlight): let winhighlight use cursor 2022-06-07 02:15:32 -04:00
zeertzjq
9e442c17ee
fix(input): allow Ctrl-C to interrupt a recursive mapping even if mapped (#18885) 2022-06-07 12:41:18 +08:00
zeertzjq
ab1f96e1d5
vim-patch:8.2.5064: no test for what 8.1.0052 fixes (#18881)
Problem:    No test for what 8.1.0052 fixes.
Solution:   Add a test. (closes vim/vim#10531)
3760bfddc4
2022-06-07 00:19:57 +08:00
Mathias Fußenegger
e4df1c9b9e
fix(lsp): fix multi client handling in code action (#18869)
Fixes https://github.com/neovim/neovim/issues/18860
2022-06-05 16:43:32 +02:00
dundargoc
ff20d40321
docs: fix typos (#18269)
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Dan Sully <dan+github@sully.org>
Co-authored-by: saher <msaher.shair@gmail.com>
Co-authored-by: Stephan Seitz <stephan.seitz@fau.de>
Co-authored-by: Benedikt Müller <d12bb@posteo.de>
Co-authored-by: Andrey Mishchenko <mishchea@gmail.com>
Co-authored-by: Famiu Haque <famiuhaque@protonmail.com>
Co-authored-by: Oliver Marriott <hello@omarriott.com>
2022-06-04 11:56:36 +08:00
Mathias Fußenegger
c6d747e6a5
feat(lsp): send didChangeConfiguration after init (#18847)
Most LSP servers require the notification to correctly load the
settings and for those who don't it doesn't cause any harm.

So far this is done in lspconfig, but with the addition of vim.lsp.start
it should be part of core.
2022-06-03 18:16:11 +02:00
Oliver Marriott
9aba204335
fix(hl): set Normal hl group sg_attr value #18820
fix #18024
2022-06-03 08:29:49 -07:00
zeertzjq
57a296d899
fix(inccommand): avoid crash if callback changes inccommand option (#18830)
clang: Result of operation is garbage or undefined
clang: Uninitialized argument value

Also check for == 's' instead of != 'n' as it is more straightforward.

Also fix another unrelated PVS warning:
PVS/V1071: Return value of win_comp_pos() is not always used
2022-06-02 03:48:36 +08:00
zeertzjq
19e80738e0
fix(screen): restart win_update() if a decor provider changes signcols (#18768) 2022-06-01 22:53:29 +08:00
Javier Lopez
d837b6d50c
fix(checkhealth): skip vim.health #18816
Problem:
https://github.com/neovim/neovim/pull/18720#issuecomment-1142614996

The vim.health module is detected as a healthcheck, which produces spurious errors:

    vim: require("vim.health").check()
    ========================================================================
    - ERROR: Failed to run healthcheck for "vim" plugin. Exception:
      function health#check, line 20
      Vim(eval):E5108: Error executing lua [string "luaeval()"]:1: attempt to call field 'check' (a nil value)
      stack traceback:
      [string "luaeval()"]:1: in main chunk

Solution:
Skip vim.health when discovering healthchecks.
2022-06-01 07:10:10 -07:00
zeertzjq
96c494dec3
refactor: correct comments and assertions about mapping rhs <Nop> (#18821)
Also avoid referring to mappings as "keymaps" in commands and docs.

						*map_empty_rhs* *map-empty-rhs*
You can create an empty {rhs} by typing nothing after a single CTRL-V (you
have to type CTRL-V two times).  Unfortunately, you cannot do this in a vimrc
file.
2022-06-01 21:37:01 +08:00
zeertzjq
f40adf770d
fix(inccommand): do not try to preview an ambiguous command (#18827) 2022-06-01 20:17:52 +08:00
Gregory Anders
046b4ed461 feat(fs): add vim.fs.normalize() 2022-05-31 13:30:10 -06:00
Gregory Anders
f271d70661 feat(fs): add vim.fs.find()
This is a pure Lua implementation of the Vim findfile() and finddir()
functions without the special syntax.
2022-05-31 13:04:41 -06:00