Commit Graph

4084 Commits

Author SHA1 Message Date
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
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