Commit Graph

6751 Commits

Author SHA1 Message Date
zeertzjq
2fce95ec43
vim-patch:9.1.0033: Insert mode not stopped if closing prompt buffer modifies hidden buffer (#27051)
Problem:  Insert mode not stopped if an autocommand modifies a hidden
          buffer while closing a prompt buffer.
Solution: Don't set b_prompt_insert if stop_insert_mode is already set.
          (zeertzjq)

closes: vim/vim#13872

96958366ad
2024-01-17 08:18:52 +08:00
altermo
da541c0af1
vim-patch:9.1.0035: i_CTRL-] triggers InsertCharPre (#27049)
* vim-patch:9.1.0035: i_CTRL-] triggers InsertCharPre

Problem:  i_CTRL-] triggers InsertCharPre
Solution: Return if CTRL-] is received. InsertCharPre
          is supposed to be only used for chars to be inserted
          but i_CTRL-] triggers expansion and is not inserted
          into the buffer (altermo)

closes: vim/vim#13853
closes: vim/vim#13864

7d711fe209
2024-01-17 07:35:32 +08:00
Lewis Russell
8f02ae82e2 test: use integers for API Buffer/Window/Tabpage EXT types 2024-01-16 19:11:49 +00:00
Sean Dewar
91dc04a5e1
vim-patch:9.1.0013: Modula2 filetype support lacking (#27020)
Problem:  Modula2 filetype support lacking
Solution: Improve the Modula-2 runtime support, add additional modula2
          dialects, add compiler plugin, update syntax highlighting,
          include syntax tests, update Makefiles (Doug Kearns)

closes: vim/vim#6796
closes: vim/vim#8115

68a8947069

- Luaify the detection script:

  - Split the `(*!m2foo*)` and `(*!m2foo+bar*)` detection into two Lua patterns,
    as Lua capture groups cannot be used with `?` and friends (as they only work
    on character classes).

  - Use `vim.api.nvim_buf_call()` (ew) to call `modula2#SetDialect()` to ensure
    `b:modula2` is set for the given bufnr.

- Skip the syntax screendump tests. (A shame as they test some of the detection
  from `(*!m2foo+bar*)` tags, but I tested this locally and it seems to work)

- Port the synmenu.vim changes from Vim9 script. (Also tested this locally)

- (And also add the missing comma for `b:browsefilter` from earlier.)

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2024-01-16 17:45:57 +00:00
Luuk van Baal
c6864b0d14 fix(column): redraw 'statuscolumn' on wrapped lines with 'relativenumber'
Problem:  The 'statuscolumn' is not redrawn on the wrapped part of a
          line when moving the cursor with 'relativenumber' set.
Solution: Redraw the 'statuscolumn' for the entire line height in the
          "col_rows" win_line() code path.
2024-01-16 12:13:36 +01:00
zeertzjq
46a7c1b319
vim-patch:partial:9.1.0027: Vim is missing a foreach() func (#27037)
Problem:  Vim is missing a foreach() func
Solution: Implement foreach({expr1}, {expr2}) function,
          which applies {expr2} for each item in {expr1}
          without changing it (Ernie Rael)

closes: vim/vim#12166

e79e207760

Partial port as this doesn't handle non-materialized range() lists.

vim-patch:c92b8bed1fa6

runtime(help): delete duplicate help tag E741 (vim/vim#13861)

c92b8bed1f

Co-authored-by: Ernie Rael <errael@raelity.com>
2024-01-16 11:30:35 +08:00
zeertzjq
267e90f31d
fix(edit): don't go to Terminal mode when stopping Insert mode (#27033) 2024-01-16 10:42:09 +08:00
zeertzjq
a34451982f
vim-patch:8.1.1968: crash when using nested map() (#27029)
Problem:    Crash when using nested map().
Solution:   Clear the pointer in prepare_vimvar(). (Ozaki Kiichi,
            closes vim/vim#4890, closes vim/vim#4891)

27da7de7c5

Cherry-pick Test_filter_map_nested() from patch 8.1.1964.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2024-01-16 09:32:57 +08:00
zeertzjq
73e1942abe
vim-patch:9.1.0009: Cannot easily get the list of matches (#27028)
Problem:  Cannot easily get the list of matches
Solution: Add the matchstrlist() and matchbufline() Vim script
          functions (Yegappan Lakshmanan)

closes: vim/vim#13766

Omit CHECK_LIST_MATERIALIZE(): it populates a List with numbers only,
and there is a check for strings below.

f93b1c881a

vim-patch:eb3475df0d92

runtime(doc): Replace non-breaking space with normal space (vim/vim#13868)

eb3475df0d

Co-authored-by: Yegappan Lakshmanan <4298407+yegappan@users.noreply.github.com>
2024-01-16 08:00:08 +08:00
Daniel Steinberg
7589336120
feat(terminal): respond to OSC background and foreground request (#17197)
The motivation for this update is Issue #15365, where background=light
is not properly set for Nvim running from an Nvim :terminal. This can be
encountered when e.g., opening a terminal to make git commits, which
opens EDITOR=nvim in the nested terminal.

Under the implementation of this commit, the OSC response always
indicates a black or white foreground/background. While this may not
reflect the actual foreground/background color, it permits 'background'
to be retained for a nested Nvim instance running in the terminal
emulator. The behaviour matches Vim.
2024-01-15 10:12:07 -06:00
zeertzjq
9c202b9392
fix(grid): handle clearing half a double-width char (#27023) 2024-01-15 23:45:11 +08:00
Luuk van Baal
967c7abde3 fix(column): keep track of number of lines with number of signs
Problem:  Some edge cases to the old (pre-#26406) and current "b_signcols"
          structure result in an incorrectly sized "auto" 'signcolumn'.
Solution: * Implement a simpler 'signcolumn' validation strategy by immediately
            counting the number of signs in a range upon sign insertion and
            deletion. Decrease in performance here but there is a clear path
            forward to decreasing this performance hit by moving signs to a
            dedicated marktree, or by adding meta-data to the existing
            marktree which may be queried more efficiently?
          * Also replace "max_count" and keep track of the number of lines with
            a certain number of signs. This makes it so that it is no longer
            necessary to scan the entire buffer when the maximum number of signs
            decreases. This likely makes the commit a net increase in performance.
          * To ensure correctness we also have re-initialize the count for an
            edited region that spans multiple lines. Such an edit may move the
            signs within it. Thus we count and decrement before splicing the
            marktree and count and increment after.
2024-01-15 09:37:53 +00:00
Evgeni Chasnovski
0c850add3e
fix(colorscheme): default statusline groups usability #26921
Problem: Current values of `StatusLine` and `StatusLineNC` are currently
  designed to be visually distinctive while being not intrusive.
  However, the compromise was more shifted towards "not intrusive".
  After the feedback, statusline highlight groups should be designed to:
  - Make current window clearly noticeable. Meaning `StatusLine` and
    `StatusLineNC` should obviously differ.
  - Make non-current windows clearly separable. Meaning `StatusLineNC`
    and `Normal`/`NormalNC` should obviously differ.

Solution:
  - Update `StatusLineNC` to have more visible background.
  - Update `StatusLine` to be inverted variant of `StatusLineNC`.
  - Update `WinBar` and `WinBarNC` to not link to `StatusLine` and
    `StatusLineNC` because it makes two goals harder to achieve.
  - Update `TabLine` to link to `StatusLineNC` instead of `StatusLine`
    to not be very visually intrusive.
2024-01-13 16:35:37 -08:00
bfredl
2dc439c672
Merge pull request #26734 from bfredl/splitaroo
fix(buffer_updates): correct buffer updates when splitting empty line
2024-01-13 10:59:46 +01:00
bfredl
e5d9b15044 fix(buffer_updates): correct buffer updates when splitting empty line
fixes #11591
2024-01-13 10:39:32 +01:00
zeertzjq
64a50d08c4 vim-patch:9.1.0021: i_CTRL-R- doesn't work for multibyte chars in Replace mode
Problem:  i_CTRL-R- doesn't work for multibyte chars in Replace mode,
          Coverity complains missing return value for u_save_cursor()
Solution: Use mb_charlen() and del_chars() instead, handle failure mode
          for u_save_cursor() correctly (@zeertzjq)

closes: vim/vim#13846

424ec1f235
2024-01-13 08:31:01 +08:00
zeertzjq
2783b6b0a4 vim-patch:9.1.0015: i_CTRL-R- no longer works in replace mode
Problem:  i_CTRL-R- no longer works in replace mode
Solution: delete characters in replace mode before putting, add a test,
          add a bit warning into the documentation, that i_CTRL-R-P/O
          is not supported in Replace mode for now

fixes: vim/vim#13792
closes: vim/vim#13816

5d5cbb2b9a

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-01-13 08:29:47 +08:00
zeertzjq
4142b8cd2c vim-patch:8.2.3439: deleted lines go to wrong yank register
Problem:    Deleted lines go to wrong yank register.
Solution:   Reset y_append when not calling get_yank_register(). (Christian
            Brabandt, closes vim/vim#8872)

78eb9cce91

Nvim has removed y_append static variable and already works as expected.

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-01-13 08:29:47 +08:00
dundargoc
c8f696f2b0 vim-patch:9.1.0025: A few typos in tests and justify.vim
Problem:  A few typos in tests and justify.vim
Solution: fix them

closes: vim/vim#13848

dc4c37b9d5

Co-authored-by: dundargoc <gocdundar@gmail.com>
2024-01-12 22:24:52 +01:00
Lewis Russell
07a7c0ec99
Merge pull request #26994 from lewis6991/vimhelpers
test: big cleanup
2024-01-12 19:40:58 +00:00
Lewis Russell
795f896a57 test: rename (meths, funcs) -> (api, fn) 2024-01-12 18:59:14 +00:00
Lewis Russell
4f81f506f9 test: normalise nvim bridge functions
- remove helpers.cur*meths
- remove helpers.nvim
2024-01-12 17:53:27 +00:00
Lewis Russell
c30f2e3182 test: typing for helpers.meths 2024-01-12 13:01:06 +00:00
Christian Clason
f46ae13685 vim-patch:9.1.0016: default diff highlighting is too noisy
Problem:  default diff highlighting is too noisy
Solution: Link diff highlighting groups to new
          Added/Removed/Changed, revert previous change
          (Romain Lafourcade)

Remove diff* links added in vim/vim#13776 and doc added in commit b1392be

The links added in vim/vim#13776 are way too noisy for the contexts in which
the `diff` syntax is applied (git commits, patches, etc.).

This commit:

- removes those links
- adds new default highlighting groups Added, Changed and
  Removed
- links the diff highlighting groups to those new defaults
- removes the doc changes
- adjusts the syntax_completion test for those newly added group
  names

Note: Changes to the default color schemes will be handled separately,
by adding links to those newly created Added/Removed/Changed
highlighting groups.

related: vim/vim#13776
closes vim/vim#13825

124371c5a1

Co-authored-by: Romain Lafourcade <romain.lafourcade@razorfish.fr>
2024-01-12 13:52:26 +01:00
Lewis Russell
284e0ad26d test: use vim.mpack and vim.uv directly 2024-01-12 12:04:20 +00:00
Lewis Russell
56a2ec5c79 test: use vim.inspect directly 2024-01-12 12:04:20 +00:00
Lewis Russell
7a259d01ae test: remove helpers.sleep() 2024-01-12 12:04:19 +00:00
Lewis Russell
d33e1da9b7 test: do not inject vim module into global helpers 2024-01-12 12:04:18 +00:00
zeertzjq
3bcf8e5622
vim-patch:9.1.0011: regexp cannot match combining chars in collection (#26992)
Problem:  regexp cannot match combining chars in collection
Solution: Check for combining characters in regex collections for the
          NFA and BT Regex Engine

Also, while at it, make debug mode work again.

fixes vim/vim#10286
closes: vim/vim#12871

d2cc51f9a1

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-01-12 14:09:10 +08:00
Lewis Russell
2f9ee9b6cf fix(doc): improve doc generation of types using lpeg
Added a lpeg grammar for LuaCATS and use it in lua2dox.lua
2024-01-11 16:24:12 +00:00
JD
a767c046f4
feat(vim.iter): add Iter:flatten (#26786)
Co-authored-by: Gregory Anders <greg@gpanders.com>
Co-authored-by: Jongwook Choi <wookayin@gmail.com>
2024-01-10 20:57:51 -06:00
zeertzjq
a7550a20e0
fix(pum): handle right-click menu repositioning with multigrid (#26975) 2024-01-10 12:56:43 +08:00
Gregory Anders
fa17a5ab49
fix(terminal): use terminal buffer for TermRequest autocommand (#26974) 2024-01-09 21:31:37 -06:00
Ghjuvan Lacambre
beca827212
feat(terminal): trigger TermRequest autocommand events (#22159)
This commit implements a new TermRequest autocommand event and has Neovim
emit this event when children of terminal buffers emit an OSC or DCS sequence
libvterm does not handle.

The TermRequest autocommand event has additional data in the
v:termrequest variable.

Co-authored-by: Gregory Anders <greg@gpanders.com>
2024-01-09 08:27:56 -06:00
zeertzjq
d54156ed08
fix(extmarks): blending space shouldn't overwrite wide char (#26960) 2024-01-09 19:16:44 +08:00
zeertzjq
ee3d4f6b90
fix(extmarks): handle overwriting right half of wide char (#26951) 2024-01-09 05:37:08 +08:00
bfredl
aeb053907d refactor(options): use schar_T representation for fillchars and listchars
A bit big, but practically it was a lot simpler to change over all
fillchars and all listchars at once, to not need to maintain two
parallel implementations.

This is mostly an internal refactor, but it also removes an arbitrary
limitation: that 'fillchars' and 'listchars' values can only be
single-codepoint characters. Now any character which fits into a single
screen cell can be used.
2024-01-08 14:37:55 +01:00
James McCoy
8861ad83fd
fix(test/tui_spec): pass the expected NULL-sentinel to execl()
Since execl() is a variadic function, it requries a NULL-terminal to
indicate the end of its argument list, c.f. exec(3)

> The first argument, by convention, should point to the filename
> associated with the file being executed.  The list of arguments *must*
> be terminated by a null pointer

This fixes the failure seen on aarch64 and i386, due to garbage data
being considered part of the variadic arguments.
2024-01-06 06:57:31 -05:00
zeertzjq
14918118e8 vim-patch:9.1.0012: regression with empty inner blocks introduced
Problem:  regression with empty inner blocks introduced
          (after v9.1.0007)
Solution: Set correct cursor position, Check for visual mode
          being active (Maxim Kim)

relates: vim/vim#13514
closes: vim/vim#13819

3779516988

Co-authored-by: Maxim Kim <habamax@gmail.com>
2024-01-06 06:25:37 +08:00
zeertzjq
f38f86b1ad vim-patch:9.1.0007: can select empty inner text blocks
Problem:  can select empty inner text blocks
          (laurentalacoque)
Solution: make selecting empty inner text blocks an error

textobjects: Make selecting inner empty blocks an error

fixes: vim/vim#13514
closes: vim/vim#13523

ad4d7f446d

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-01-06 06:24:02 +08:00
luukvbaal
c509f4907b
fix(column): fill 'statuscolumn' clickdefs with evaluated width (#26891) 2024-01-05 21:34:54 +08:00
zeertzjq
e09adfdcff
fix(terminal): check if mouse on statusline/tabline/winbar/vsep (#26892) 2024-01-05 10:59:52 +08:00
zeertzjq
dab5844082
vim-patch:9.1.0010: Keymap completion is not available (#26888)
Problem:  Keymap completion is not available
Solution: Add keymap completion (Doug Kearns)

Add keymap completion to the 'keymap' option, user commands and builtin
completion functions.

closes: vim/vim#13692

81642d9d6f

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2024-01-05 08:23:51 +08:00
Jaehwang Jung
dc48a98f9a fix(decorations): validate botline for on_win
Problem:
Many decoration providers (treesitter injection highlighting, semantic
token highlighting, inlay hint) rely on the correctness of the `botline`
argument of `on_win` callback. However, `botline` can be smaller than
the actual line number of the last displayed line if some lines are
folded. In such cases, some decorations will be missing in the lines not
covered by `botline`.

Solution:
Validate `botline` when invoking `on_win`.

NOTE:
It seems that the old code was deliberately avoiding this presumably due
to performance reasons. However, I haven't experienced noticeable lag
after this change, and I believe the cost of botline computation would
be much smaller than the cost of decoration providers.
2024-01-04 11:37:00 +00:00
Christian Clason
bdfea2a891 vim-patch:9.1.0001: when closing window, wincmd p may fail
Avoid `prevwin == curwin` when closing `curwin`

Problem:  When closing the current window (or when moving it to a tabpage), the
          previous window may refer to the new current window
          (`winnr() == winnr('#')`) if that window is selected as the
          new current window.

Solution: Set `prevwin = NULL` when switching away from an invalid `curwin` and
          the target window was the `prevwin`.
          (Sean Dewar)

related: vim/vim#4537
closes: vim/vim#13762

bf44b69d1f

Co-authored-by: Sean Dewar <seandewar@users.noreply.github.com>
2024-01-03 23:09:55 +01:00
zeertzjq
12cdee7245
vim-patch:9.1.0002: a closing fold expr, may start a new fold (#26876)
Problem:  a closing fold expression may unexpectedly start a new fold
          when it should end a fold
          (reported by Shota Nozaki)
Solution: if a fold hasn't started yet, do not immediately
          start a new fold with level 1
          (Shota Nozaki)

fixes: vim/vim#12768
closes: vim/vim#13748

0689b87059

Co-authored-by: Shota Nozaki <emonkak@gmail.com>
2024-01-04 05:36:38 +08:00
Lewis Russell
3734519e3b feat(lua): add noref to deepcopy
Problem:

Currently `deepcopy` hashes every single tables it copies so it can be
reused. For tables of mostly unique items that are non recursive, this
hashing is unnecessarily expensive

Solution:

Port the `noref` argument from Vimscripts `deepcopy()`.

The below benchmark demonstrates the results for two extreme cases of
tables of different sizes. One table that uses the same table lots of
times and one with all unique tables.

| test                 | `noref=false` (ms) | `noref=true` (ms) |
| -------------------- | ------------------ | ----------------- |
| unique tables (50)   | 6.59               | 2.62              |
| shared tables (50)   | 3.24               | 6.40              |
| unique tables (2000) | 23381.48           | 2884.53           |
| shared tables (2000) | 3505.54            | 14038.80          |

The results are basically the inverse of each other where `noref` is
much more performance on tables with unique fields, and `not noref` is
more performant on tables that reuse fields.
2024-01-03 19:17:52 +00:00
Justin M. Keyes
04f2f864e2 refactor: format test/* 2024-01-03 02:09:29 +01:00
Justin M. Keyes
59d117ec99 build: enable lintlua for test/ dir
Problem:
Not all Lua code is checked by stylua. Automating code-style is an
important mechanism for reducing time spent on accidental
(non-essential) complexity.

Solution:
- Enable stylua for entire `test/` directory.
- Exclude these high-churn files until this issue is resolved: https://github.com/JohnnyMorganz/StyLua/issues/829
  ```
  test/functional/ui/decorations_spec.lua  | 3560 ++++++++++++++++++++++++++++++++++++----------------
  test/functional/ui/float_spec.lua        | 5826 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------
  test/functional/ui/multigrid_spec.lua    | 1349 ++++++++++++++------
  ```
- Make surgical changes to these files (or add `stylua: ignore` in some
  small scopes) to improve the result:
  ```
  test/functional/vimscript/msgpack_functions_spec.lua | 1414 +++++++++++++++------
  test/functional/api/buffer_spec.lua                  | 1389 +++++++++++----------
  test/functional/api/vim_spec.lua                     | 2740 +++++++++++++++++++++++-----------------
  ```
- These "high churn" files are NOT excluded because the changes are
  largely an improvement:
  ```
  test/functional/plugin/lsp_spec.lua      | 2198 ++++++++++++++++++---------------
  test/functional/plugin/shada_spec.lua    | 4078 +++++++++++++++++++++++++++++++++++-------------------------
  test/functional/ui/cmdline_spec.lua      | 1199 +++++++++++-------
  test/functional/ui/popupmenu_spec.lua    | 1267 +++++++++++--------
  test/functional/ui/messages_spec.lua     | 1643 +++++++++++++++---------
  ```
- TODO: how to check "all directories"? With `GLOB_DIRS *` and `/.deps/` (or
  `.deps/`) in `.styluaignore`, Lua code in `.deps/` is still checked...
2024-01-03 02:09:28 +01:00
TheLeoP
3f788e73b3
feat(lsp): support connect via named pipes/unix domain sockets (#26032)
Closes https://github.com/neovim/neovim/issues/26031

Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
2024-01-02 10:08:36 +01:00