Commit Graph

19394 Commits

Author SHA1 Message Date
zeertzjq
0763a85f43 vim-patch:9.1.1771: complete: some redraw issues with 'autocomplete'
Problem:  complete: some redraw issues with 'autocomplete'
Solution: Fix the issues (Girish Palya)

This commit contains the following changes:
* Fix that wildtrigger() might leave opened popupmenu around vim/vim#18298
* Remove blinking message on the command line when a menu item from a loaded
  buffer is selected during 'autocomplete'
* Add a test for PR vim/vim#18265 to demonstrate why the PR is required for correct
  'autocomplete' behavior

fixes: vim/vim#18298
closes: vim/vim#18328

ee9a2f0512

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-19 09:58:24 +08:00
zeertzjq
dd306bd48a vim-patch:9.1.1621: flicker in popup menu during cmdline autocompletion
Problem:  When the popup menu (PUM) occupies more than half the screen
          height, it flickers whenever a character is typed or erased.
          This happens because the PUM is cleared and the screen is
          redrawn before a new PUM is rendered. The extra redraw between
          menu updates causes visible flicker.
Solution: A complete, non-hacky fix would require removing the
          CmdlineChanged event from the loop and letting autocompletion
          manage the process end-to-end. This is because screen redraws
          after any cmdline change are necessary for other features to
          work.
          This change modifies wildtrigger() so that the next typed
          character defers the screen update instead of redrawing
          immediately. This removes the intermediate redraw, eliminating
          flicker and making cmdline autocompletion feel smooth
          (Girish Palya).

Trade-offs:
This behavior change in wildtrigger() is tailored specifically for
:h cmdline-autocompletion. wildtrigger() now has no general-purpose use
outside this scenario.

closes: vim/vim#17932

da9c966893

Use pum_check_clear() instead of update_screen().
Cherry-pick Test_wildtrigger_update_screen() change from patch 9.1.1682.

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-19 09:58:24 +08:00
zeertzjq
c9f6267402 vim-patch:9.1.1773: Crash in BufLeave after BufUnload closes other windows (#35830)
Problem:  Crash in BufLeave/WinLeave/TabLeave when closing window after
          BufUnload closes all other windows in the tab page.
Solution: Avoid duplicate BufLeave/WinLeave events. Trigger TabLeave
          before removing the buffer (zeertzjq).

related: vim/vim#14166
related: neovim/neovim#33603
closes: vim/vim#18330

0c70820015
2025-09-19 07:40:12 +08:00
zeertzjq
63ece2b151 fix(swapfile): don't use uninitialized memory (#35813)
Also add a test for #35802.
2025-09-17 11:36:27 +08:00
luukvbaal
cbfa7f0d7b fix(swapfile): handle newlines in swapfile list message #35802 2025-09-16 11:28:34 -07:00
zeertzjq
051b8b88c8 vim-patch:9.1.1762: completion: selected item not cleared on <BS> with 'ac'
Problem:  completion: selected item not cleared on backspace when
          'autocomplete' is set
Solution: Clear the selected item (Girish Palya)

closes: vim/vim#18260

5c9b71d63c

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-16 20:58:27 +08:00
zeertzjq
ff777f9a85 docs: small fixes (#35791)
Close #34938
Close #35030
Close #35233
Close #35259
Close #35290
Close #35433
Close #35541
Close #35766
Close #35792

Co-authored-by: huylg <45591413+huylg@users.noreply.github.com>
Co-authored-by: Jason Del Ponte <961963+jasdel@users.noreply.github.com>
Co-authored-by: sooriya <74165167+thuvasooriya@users.noreply.github.com>
Co-authored-by: Andrew Braxton <andrewcbraxton@gmail.com>
Co-authored-by: Enric Calabuig <enric.calabuig@gmail.com>
Co-authored-by: Augusto César Dias <augusto.c.dias@gmail.com>
Co-authored-by: David Sierra DiazGranados <davidsierradz@gmail.com>
Co-authored-by: Stepan Nikitin <90522882+vectravox@users.noreply.github.com>
Co-authored-by: Emilien Breton <bricktech2000@gmail.com>
2025-09-16 11:41:36 +08:00
Yochem van Rosmalen
566e8c66f9 docs: optionlinks don't need the bars #35777
Problem:
Options links work even without vertical bars around them due to their
single quotes: the bars are unnecessary.

Solution:
Remove them.
2025-09-15 12:36:44 -07:00
bfredl
0458a1e694 build(ci): bump zig to 0.15.1 and add more platforms
- Bump zig version to 0.15.1 and workaround zig fetch hang (ziglang/zig#24916)
- add mac os zig build (currently without luajit, linker failure)
- Add windows zig build, currently with very limited testing
2025-09-15 12:10:23 +02:00
zeertzjq
1264d1156c fix(lua): don't leak timer when vim._watch.watch() fails (#35768)
This fixes the following warning in tests with ASAN or TSAN:

    -------- Running tests from test/functional/lua/watch_spec.lua
    RUN      T4253 vim._watch watch() ignores nonexistent paths: 29.00 ms OK
    nvim took 2006 milliseconds to exit after last test
    This indicates a likely problem with the test even if it passed!
2025-09-15 11:15:25 +08:00
zeertzjq
ca9cc98298 vim-patch:partial:235e77a: runtime(doc): Tweak documentation style more in options and ft_hare (#35761)
closes: 18289

235e77a3a3

Skip ft_hare.txt.

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-09-15 08:00:43 +08:00
zeertzjq
7b8b9d270f vim-patch:9.1.1758: Diff mode crashes when adding text property in autocommand (#35760)
Problem:  Diff mode crashes when adding text property in autocommand
          (after 9.1.1557).
Solution: Only restore ML_EMPTY memline flag, ignore the others
          (zeertzjq).

fixes: vim/vim#18288
closes: vim/vim#18291

46e22fd2f7
2025-09-15 07:17:37 +08:00
zeertzjq
fbb1caf5f8 vim-patch:97e0f95: runtime(doc): tweak documentation style a bit more in options.txt (#35755)
related: vim/vim#18284

97e0f955da
2025-09-14 16:45:18 +08:00
skewb1k
a897cc17a5 feat(json): vim.json.encode() sort_keys #35574
Problem: There is no way to ensure a stable key order when encoding a JSON string,
which can be useful for comparisons and producing cleaner diffs.

Solution: Introduce a `sort_keys` option for `vim.json.encode()`,which
is disabled by default. When enabled, object keys are sorted in
alphabetical order.
2025-09-13 21:17:07 -07:00
Justin M. Keyes
a30a947593 docs: move editorconfig.txt into plugins.txt
It helps to have plugins living in one common area, because it signals
to users the mechanisms for controlling them, which are typically driven
by keymaps and autocmds rather than builtin options.

We can always revisit if plugins.txt gets "too big" (for example, we may
want to introduce "project.txt" for the project concept, where
editorconfig and 'exrc' are relevant), but for now it's rather unusual
for editorconfig.txt to have its own dedicated helpfile.
2025-09-13 23:23:24 -04:00
Justin M. Keyes
db67607201 docs: manpage, keycodes, json 2025-09-13 22:49:50 -04:00
zeertzjq
5ef567d130 build(gen_helptags): update check for example (#35750)
Follow-up to ae588c183f.
2025-09-14 08:38:06 +08:00
zeertzjq
68f40386ed vim-patch:partial:450d591: runtime(doc): tweak documentation style (#35748)
closes: vim/vim#18284

450d59145e

Skip ft_hare.txt.

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-09-13 23:33:06 +00:00
fredizzimo
8ae9a44d38 feat(ui): support grid=0 in nvim_input_mouse #32535
Problem:
Multigrid UIs have to find out which window to send the input by using
the Nvim focus rules, which are not fully documented.

Furthermore,`getmousepos()` has several problems when multigrid is
enabled, with the main one being that screenrow and screencol are window
relative instead of screen relative, due to the fact that the UI don't
send any absolute coordinates.

Solution:
Allow passing 0 as grid to `nvim_input_mouse`, with absolute
coordinates, which lets nvim determine the actual window to send the
mouse input to. This works as long as nvim is in charge of the window
positioning. If the UI repositions or resizes the windows, it can still
pass the grid it determines like before.
2025-09-13 14:57:04 -07:00
luukvbaal
c1648cf820 fix(ui): forward 'rulerformat' to msg_ruler event #35707
Problem:  A 'rulerformat' not part of the statusline is not emitted through
          msg_ruler events.
Solution: Build the message chunks to emit as a msg_ruler event.
2025-09-13 13:34:58 -07:00
github-actions[bot]
ec89c5b261 docs: update version.c #35670
vim-patch:8.1.0000: release
vim-patch:8.1.0058: display problem with margins and scrolling
vim-patch:8.1.0065: balloon displayed at the wrong position
vim-patch:8.1.0158: GUI: input() fails if CTRL-C was pressed before
vim-patch:8.1.0328: inputlist() doesn't work with a timer

vim-patch:8.1.1560: popup window hidden option not implemented yet
vim-patch:8.1.1600: cannot specify highlighting for popup window scrollbar
vim-patch:8.1.1810: popup_getoptions() is missing an entry for "mapping"
vim-patch:8.1.1811: popup window color cannot be set to "Normal"
vim-patch:8.1.1943: more code can be moved to evalvars.c
vim-patch:8.1.2265: when popup with "botleft" does not fit it flips incorrectly
vim-patch:8.1.2266: position unknown for a mouse click in a popup window

vim-patch:8.2.1190: Vim9: checking for Vim9 syntax is spread out
vim-patch:8.2.1405: Vim9: vim9compile.c is getting too big
vim-patch:8.2.2227: Vim9: recognizing lambda is too complicated
vim-patch:8.2.4036: Vim9: script test file is getting too long
vim-patch:8.2.4159: MS-Windows: _WndProc() is very long
vim-patch:8.2.4189: MS-Windows: code for "old look" is obsolete
vim-patch:8.2.4194: MS-Windows: code for calculating font size is duplicated
vim-patch:8.2.4198: Vim9: the switch for executing instructions is too long
vim-patch:8.2.4213: too much code for supporting old MSVC versions
vim-patch:8.2.4294: MS-Windows: #ifdefs for Cygwin are too complicated

vim-patch:9.0.1757: ex_class() function is too long

vim-patch:9.1.0361: Vim9: vim9type.c is too complicated
vim-patch:9.1.0367: compile_def_function is too long
vim-patch:9.1.0371: Vim9: compile_def_function() still too long
vim-patch:9.1.0517: MS-Windows: too long lines in Make_mvc.mak
vim-patch:9.1.0914: Vim9: compile_assignment() is too long
vim-patch:9.1.0920: Vim9: compile_assignment() too long
vim-patch:9.1.1278: Vim9: too long functions in vim9type.c
vim-patch:9.1.1092: tests: fix expected return code for python 3.13 on Windows
2025-09-13 13:06:40 -07:00
zeertzjq
4a69847df4 fix(tui): don't wait for DA1 response when stdin is closed (#35745) 2025-09-13 20:53:17 +08:00
Jan Edmund Lazo
f89e1eb036 vim-patch:8.1.1964: crash when using nested map() and filter() (#35715)
Problem:    Crash when using nested map() and filter().
Solution:   Do not set the v:key type to string without clearing the pointer.

c36350bca3

Port filter_map() changes from patch 8.1.1939.

Note: v8.1.1964 reverts a redundant change for `filter_map()` (now
within `filter_map_dict()`) from v8.1.1957.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-09-13 13:31:29 +08:00
zeertzjq
cf9b7a37cc vim-patch:9.1.1753: defaults: 'diffopt' option value can be improved (#35727)
Problem:  defaults: 'diffopt' option value can be improved
Solution: Update diffopt defaults to include "indent-heuristic" and
          "inline:char" (Yee Cheng Chin)

The default diff options have not been updated much despite new
functionality having been added to Vim.

- indent-heurstic: This has been enabled by default in Git since
  33de716387 in 2017. Given that Vim uses xdiff from Git, it makes sense
  to track the default configuration from Git.

- inline:char: This turns on character-wise inline highlighting which is
  generally much better than the default inline:simple. It has been
  implemented since vim/vim#16881 and we have not seen reports of any issues
  with it, and it has received good feedbacks.

closes: vim/vim#18255

976b365305

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2025-09-12 03:57:05 +00:00
zeertzjq
ae588c183f vim-patch:9.1.1754: :helptags doesn't skip examples with syntax
Problem:  :helptags doesn't skip examples with syntax
          (Evgeni Chasnovski)
Solution: Check for examples with syntax (zeertzjq).

fixes: vim/vim#18273
closes: vim/vim#18277

6f020cde56
2025-09-12 07:32:42 +08:00
zeertzjq
c06f0970b0 vim-patch:a0f37db: runtime(doc): use a single pattern in :h 'incsearch' example (#35721)
related: https://github.com/vim/vim/pull/18262#issuecomment-3277008408
closes: vim/vim#18270

a0f37dbbf4
2025-09-11 23:08:02 +00:00
bfredl
0923ba322b Merge pull request #35706 from bfredl/fixdoc
fix(gen): prevent "make doc" failure due to temporary files
2025-09-11 12:00:13 +02:00
Cameron Ring
0f64f0f5b6 fix(startup): crash in read_stdin #35699
Problem:
Crash on startup in some situations due to call to `set_curbuf`
with the current value of `cur_buf`.

Solution:
Switch buffers before doing the wipeout of the stdin buffer.
Use cmdline cmds instead of raw buffer pointers to avoid lifetime issues.
2025-09-10 21:37:42 -07:00
altermo
2e70f3522b docs: plugins.txt #35680
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2025-09-10 21:16:13 -07:00
James McCoy
da650de277 fix(vim.json): fix truncation of decoded numbers outside lua_Integer's range #35702
PR #34876 expanded the total range of values that cjson considers
valid. However, it didn't address the bigger problem of storing a
`long long` value in a `lua_Integer` (which is typically a typedef for
`ptrdiff_t`).

On 32-bit platforms, this ends up storing an 8-byte number into a 4-byte
variable, truncating the value.

Store the converted value in a temporary `long long` variable so we can
detect the scenario and decode into a `lua_Number`.
2025-09-10 20:46:08 -07:00
zeertzjq
c4ecb7256b vim-patch:b2c8848: runtime(doc): improve docs related to 'autocomplete'
Manual completion can still be used when 'autocomplete' is set, so
saying "active" is better than "enabled".

closes: vim/vim#18261

b2c8848055
2025-09-11 07:23:29 +08:00
zeertzjq
5a7586a109 vim-patch:9.1.1750: completion: preinserted text highlighed using ComplMatchIns
Problem:  completion: preinserted text highlighed using ComplMatchIns
Solution: Use highlighting group PreInsert and update the documentation
          (Girish Palya).

When "preinsert" is included in 'completeopt', only the PreInsert
highlight group should be applied, whether autocompletion is active or not.
Previously, ComplMatchIns was used when autocompletion was not enabled.

Related to https://github.com/vim/vim/pull/18213.

closes: vim/vim#18254

2525c56e42

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-11 07:23:28 +08:00
bfredl
805dd5d047 fix(gen): prevent "make doc" failure due to temporary files
Notably, the existence of a swap file like .buffer.c.swp might cause
mayhem. As a reasonable filter, only process *.c and *.h files using the
c grammar.
2025-09-10 12:24:30 +02:00
zeertzjq
e084a99040 vim-patch:9.1.1751: potential buffer-overflow in find_pattern_in_path() (#35705)
Problem:  potential buffer-overflow in find_pattern_in_path()
Problem:  Verify ptr p has enough room before adding ins_compl_len()

fixes: vim/vim#18195
closes: vim/vim#18249

21ecb0d2e2

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-09-10 09:39:18 +00:00
zeertzjq
014c3bad8a refactor(lua): fix coverity warning from #35536 (#35703) 2025-09-10 17:14:50 +08:00
Jan Edmund Lazo
681ec17b50 vim-patch:8.1.1940: script tests fail
Problem:    Script tests fail.
Solution:   Don't set vimvars type in set_vim_var_nr().

34ed68d40e

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-09-09 23:45:56 -04:00
Jan Edmund Lazo
f7c86742e7 vim-patch:8.1.1920: cannot always close a popup when filter consumes all events
Problem:    Cannot close a popup by the X when a filter consumes all events.
Solution:   Check for a click on the close button before invoking filters.
            (closes vim/vim#4858)

f63962378d

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-09-09 23:45:43 -04:00
Jan Edmund Lazo
89e2f346a8 vim-patch:8.1.1751: when redrawing popups plines_win() may be called often
Problem:    When redrawing popups plines_win() may be called often.
Solution:   Pass a cache to mouse_comp_pos().

9d5ffceb3f

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-09-09 23:45:43 -04:00
zeertzjq
856d2a7892 refactor: remove cmdline_pum_create() return value (#35701) 2025-09-10 08:39:08 +08:00
zeertzjq
f6ed46c2a7 vim-patch:9.1.1747: completion: redo (.) broken with preinsert and autocompletion (#35698)
Problem:  completion: redo (.) broken with preinsert and autocompletion
Solution: Make redo (.) work with preinsert and autocompletion
          (Girish Palya)

closes: vim/vim#18253

306a138172

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-09 23:53:33 +00:00
bfredl
b95aedeae4 Merge pull request #35536 from bfredl/skipahead
perf(highlight): allow decoration providers to skip ranges without data

fixes #35644
2025-09-09 20:53:31 +02:00
bfredl
5119c03be7 fix(treesitter): use subpriorities for tree ordering
This partially reverts 0b8a72b739,
that is unreverts 15e77a56b7

"priority" is an internal neovim concept which does not occur in shared
queries. Ideally a single priority space should eventually be enough
for our needs. But as we don't want to poke at the usages of
priorities right now in the wider ecosystem,
introduce the "subpriorities" so that treesitter code can distinguish
highlights of the same priorities with different tree nesting depth.

This mainly affects `injection.combined` as parent-tree nodes might appear
in the middle of child-tree nodes which otherwise is not possible.
2025-09-09 12:56:49 +02:00
bfredl
f9d2115a35 perf(highlight): allow decoration providers to skip ranges without data
Continuing the work of #31400

That PR allowed the provider to be invoked multiple times per line.
We want only to do that when there actually is more data later on the
line. Additionally, we want to skip over lines which contain no new
highlight items. The TS query cursor already tells us what the next
position with more data is, so there is no need to reinvoke the range
callback before that.

NB: this removes the double buffering introduced in #32619 which
is funtamentally incompatible with this (nvim core is supposed to keep
track of long ranges by itself, without requiring a callback reinvoke
blitz). Need to adjust the priorities some other way to fix the same issue.
2025-09-09 12:54:04 +02:00
zeertzjq
eb19206e03 vim-patch:9.1.1742: complete: preinsert does not work well with 'autocomplete' (#35692)
Problem:  complete: preinsert does not work well with preinsert
Solution: Make "preinsert" completeopt value work with autocompletion
          (Girish Palya)

This change extends Insert mode autocompletion so that 'preinsert' also
works when 'autocomplete' is enabled.

Try: `:set ac cot=preinsert`

See `:help 'cot'` for more details.

closes: vim/vim#18213

fa6fd41a94

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-09 03:35:41 +00:00
glepnir
c553008e74 fix(api): crash when moving curwin to other tabpage #35679
Problem: nvim_win_set_config may crash when attempting to move curwin to a
different tabpage if there is no other non-float available to switch to.

Solution: fix the crash. Fix ONE_WINDOW checks in winframe_find_altwin and
win_altframe to consider floating windows by instead using one_window. Allow
one_window to consider non-current tabpages. We can use one_window in
win_close_othertab now to also better reflect its use in win_close.

Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
2025-09-08 18:30:20 -07:00
zeertzjq
327a2d57eb vim-patch:d7d6a6f: runtime(doc): Improve doc for cmdline-autocompletion
- Address https://github.com/vim/vim/pull/18219#issuecomment-3264634710
- Make the cmdline-autocompletion help more user friendly

closes: vim/vim#18245

d7d6a6f05a

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-09 08:30:34 +08:00
zeertzjq
b51eba9273 vim-patch:9.1.1738: cmdline-autocompletion breaks history navigation
Problem:  cmdline-autocompletion breaks history navigation (ddad431)
Solution: Support history navigation in cmdline autocompletion (Girish
          Palya)

Up/Down arrows support history navigation when using wildtrigger()

fixes: vim/vim#18207
closes: vim/vim#18219

708ab7f5fb

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-09 08:25:19 +08:00
zeertzjq
7f2298ad32 fix(cmdline): fix inconsistent behavior with ext_popupmenu (#35688) 2025-09-09 00:11:13 +00:00
Shadman
acb99b8a65 fix(prompt_buffer): plugins can't set ': mark #35624
Problem:
Currently, prompt_buffer manages `:` mark by itself and exposes it
read-only mark. However when it fails there can be no mitigation made
by plugins. The `:` mark should act like a regular marks and be
modifiable.

Solution:
Allow plugins to set `:` mark.
2025-09-08 15:09:48 -07:00
zeertzjq
29f30ad91c vim-patch:9.1.1679: unclear what key causes CmdlineLeave autocommand (#35677)
Problem:  unclear what key causes CmdlineLeave autocommand
Solution: Set |v:char| to the key (Girish Palya).

related: vim/vim#17806
closes: vim/vim#18063

ba9551d131

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-08 11:40:12 +08:00