Commit Graph

21876 Commits

Author SHA1 Message Date
Oliver Marriott
1ad6423f02
fix(highlight): use ctermbg/fg instead of bg/fg when use_rgb=false #18982
If `use_rgb` was false, we would attempt to set the `cterm_bg_color` to the
variable `bg`, which is only retrieved from `bg` and `background` keys, not
`ctermbg`. Same for `fg`. This means the values would be `-1` (the default,
un-got value) and we'd always set the returned values to `0`.

My understanding is `fg/bg` is always "gui" values, so instead we should be
using `ctermbg` when needed.

Nb: when looking around I think this function is currently *always* called with
`use_rgb = true`.
2022-06-18 08:33:58 -07:00
zeertzjq
901fde60c6
Merge pull request #19011 from zeertzjq/vim-8.2.5120
vim-patch:8.2.{5120.5121}
2022-06-18 20:02:52 +08:00
zeertzjq
dc56b442d8 vim-patch:8.2.5121: interrupt test sometimes fails
Problem:    Interrupt test sometimes fails.
Solution:   Use a different file name.
8d6420631c

Add a modeline to test_interrupt.vim.
2022-06-18 19:37:45 +08:00
zeertzjq
aab05cd5ff vim-patch:8.2.5120: searching for quotes may go over the end of the line
Problem:    Searching for quotes may go over the end of the line.
Solution:   Check for running into the NUL.
2f074f4685
2022-06-18 19:36:43 +08:00
zeertzjq
966d55effe
vim-patch:8.2.5116: "limit" option of matchfuzzy() not always respected (#19005)
Problem:    "limit" option of matchfuzzy() not always respected.
Solution:   Remove "else". (Kazuyuki Miyagi, closes vim/vim#10586)
47f1a55849
2022-06-18 13:43:02 +08:00
Christian Clason
e651ae5864
vim-patch:d592deb33652 (#19002)
Update runtime files
d592deb336
2022-06-17 20:38:21 +02: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
Lewis Russell
e0aa1d87e8
test(treesitter): add benchmark #18989
add benchmark from #18109
2022-06-16 17:22:43 -07:00
zeertzjq
1fe94cb008
docs: improve 'insertmode' emulation #18962
The current emulation script enters Insert mode much too frequently.
Using only BufWinEnter seems to be a closer simulation.

Also add a few more mappings.
2022-06-16 17:16:33 -07:00
Justin M. Keyes
c57f6b28d7
Merge #8519 feat: name, test ids, sockets in stdpath(state) 2022-06-17 01:23:48 +02:00
bfredl
279bc71f3c
Merge pull request #18760 from kevinhwang91/fix-treesitter-fold
fix(treesitter): new iter if folded
2022-06-16 18:29:27 +02:00
kevinhwang91
8780076a78 fix(treesitter): new iter if folded 2022-06-16 17:38:10 +02:00
Christian Clason
35c9fe9895
vim-patch:8.2.5110: icon filetype not recognized from the first line (#18987)
Problem:    Icon filetype not recognized from the first line.
Solution:   Add a check for the first line. (Doug Kearns)
bf6614643f
2022-06-16 15:53:38 +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
Justin M. Keyes
fa4b0c3ba5
refactor(log): use msg_schedule_semsg #18950 2022-06-15 17:23:13 -07:00
zeertzjq
4cc05a75ea
vim-patch:8.2.5097: using uninitialized memory when using 'listchars' (#18974)
Problem:    Using uninitialized memory when using 'listchars'.
Solution:   Use the length returned by mb_char2bytes(). (closes vim/vim#10576)
74ac29cecd
2022-06-16 07:18:27 +08:00
zeertzjq
0c6ad03c3f
fix(ui): do not call showmode() when setting window height (#18969) 2022-06-15 19:41:58 +08:00
Christian Clason
504d7decbd
vim-patch:8c1b8cb2e0b5 (#18966)
Update runtime files
8c1b8cb2e0
2022-06-15 09:20:32 +02: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
dundargoc
6de7f32d52
docs: fix typos (#18866)
docs: fix typos and similarly insignificant changes

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: smjonas <jonas.strittmatter@gmx.de>
Co-authored-by: kanreki <32443233+kanreki@users.noreply.github.com>
2022-06-15 08:49:54 +08:00
zeertzjq
8ba64dd3ad
Merge pull request #18947 from zeertzjq/vim-8.2.1897
vim-patch:8.2.{1897,1898,5088}
2022-06-14 21:57:08 +08:00
bfredl
2a2fb8be74
Merge pull request #18880 from bfredl/arena
perf(memory): use an arena for RPC decoding
2022-06-14 15:20:37 +02:00
zeertzjq
0a0cda9528 vim-patch:8.2.5088: value of cmod_verbose is a bit complicated to use
Problem:    Value of cmod_verbose is a bit complicated to use.
Solution:   Use zero for not set, value + 1 when set. (closes vim/vim#10564)
cd7496382e

Omit has_cmdmod(): only used for Vim9 script
2022-06-14 21:12:27 +08:00
zeertzjq
6130b4a84b vim-patch:8.2.1898: command modifier parsing always uses global cmdmod
Problem:    Command modifier parsing always uses global cmdmod.
Solution:   Pass in cmdmod_T to use.  Rename struct fields consistently.
e100440158
2022-06-14 20:58:34 +08:00
zeertzjq
dad898b665 refactor(api): remove redundant fields of CmdParseInfo 2022-06-14 20:58:34 +08:00
zeertzjq
da41ca299f vim-patch:8.2.1897: command modifiers are saved and set inconsistently
Problem:    Command modifiers are saved and set inconsistently.
Solution:   Separate parsing and applying command modifiers.  Save values in
            cmdmod_T.
5661ed6c83

Cherry-pick: :0verbose fix from patch 8.2.4741
2022-06-14 20:58:34 +08:00
dundargoc
cd9e08cb94
refactor: enable -Wconversion warning for eval.c (#18448)
Work on https://github.com/neovim/neovim/issues/567
2022-06-14 20:57:06 +08:00
bfredl
3f5c647de9 perf(memory): use an arena for RPC decoding
drawback: tracing memory errors with ASAN is less accurate for arena
allocated memory.
Therefore, to start with it is being used for Object types around
serialization/deserialization exclusively. This is going to have
a large impact especially when TUI is refactored as a co-prosess
as all UI events will be serialized and deserialized by nvim itself.
2022-06-14 14:33:04 +02:00
Christian Clason
2f2022773f
vim-patch:6ba83ba9ee29 (#18948)
Update runtime files.
6ba83ba9ee
2022-06-14 08:52:04 +02: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
rhcher
7f8f8d6cb7
feat(lsp): sort codelens if multiple item per line (#18951) 2022-06-13 19:31:48 +02:00
zeertzjq
e13c36e312
vim-patch:8.2.0577: not all modifiers supported for :options (#18952)
Problem:    Not all modifiers supported for :options.
Solution:   Use all cmdmod.split flags. (closes vim/vim#4401)
7a1637f4c0

Cherry-pick Test_options_command() change from patch 8.2.0540
2022-06-13 22:04:39 +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
2f71d4708e
Merge pull request #18902 from bfredl/fulexit
fix(tests): check for EOF in requests to nvim properly
2022-06-13 11:23:40 +02:00
zeertzjq
a68f5fccb3
Merge pull request #18934 from zeertzjq/vim-8.2.5079
vim-patch:8.2.{5079,5081,5083}
2022-06-13 16:30:13 +08:00
bfredl
e3281d992e fix(tests): check for EOF on exit of nvim properly 2022-06-13 10:15:44 +02:00
zeertzjq
e95f32a717 vim-patch:8.2.5083: autocmd test still fails on MS-Windows
Problem:    Autocmd test still fails on MS-Windows.
Solution:   Change backward to forward slashes.
db77c49401
2022-06-13 16:05:26 +08:00
zeertzjq
1c16e5bb11 vim-patch:8.2.5081: autocmd test fails on MS-Windows
Problem:    Autocmd test fails on MS-Windows.
Solution:   Set shellslash to get forward slashes.
7c0d0c3c75
2022-06-13 16:05:19 +08:00
zeertzjq
254454d0c5 vim-patch:8.2.5079: DirChanged autocommand may use freed memory
Problem:    DirChanged autocommand may use freed memory. (Shane-XB Qian)
Solution:   Free the memory later. (closes vim/vim#10555)
d8c9d32c89

Code change is N/A as Nvim gets the full current directory again before
applying the autocommand, so this just ports the tests.
2022-06-13 16:05:02 +08:00
Justin M. Keyes
dd8b6094c0
build(lint): fix lintuncrustify #18945
Problem:
lintuncrustify doesn't actually do anything.

Solution:
- Fix the parameters.
- Fail correctly on nonzero result.

followup to #18940
2022-06-12 18:49:38 -07: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
dundargoc
3c7b91da10
build: remove CMAKE_CROSSCOMPILING code #18914
This is rarely, if ever, used and certainly not tested. It's likely this
isn't functional anymore.
2022-06-12 15:11:14 -07:00
Justin M. Keyes
f90174c98c
build(lint): fix luacheck not found #18940
Problem:
Since 6d57bb89c1 #18543, luacheck is not found on some systems when
running the "lintlua" target.

Solution:
- Move the find_program() to the top-level CMakeLists.txt
- Define a def_cmd_target() function with fewer assumptions than the old
  lint() function.
- Move "lintuncrustify" to src/nvim/CMakeLists.txt so it can reuse the
  $LINT_NVIM_SOURCES already defined there.
- Make the lint targets _fatal_ by default. There is little reason for
  the "lint" umbrella target defined in Makefile to exist if it's going
  to ignore the absence of the actual linters.
- For now, keep the uncrustify call in a separate cmake script so that
  it can be silenced (too noisy).
2022-06-12 15:08:01 -07: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