Commit Graph

35080 Commits

Author SHA1 Message Date
zeertzjq
1883fe39bd test: fix some type warnings (#37483) 2026-01-21 15:11:47 +08:00
glepnir
c556972ae1 fix(api): auto-load buffers in nvim_buf_set_* operations (#35046)
fix(api): auto-load buffers in nvim_buf_set_* operations

Problem: Setting marks, lines, or text on unloaded buffers fails because
ml_line_count is not accurate until the buffer is loaded.

Solution: Add require_loaded_buffer() helper and use it in write operations
(nvim_buf_set_lines, nvim_buf_set_text, nvim_buf_set_mark). These now
auto-load buffers as needed.
2026-01-21 14:17:44 +08:00
Kevin Goodsell
2c2203c040 test: fix has() test failure (#37480)
Problem: has("terminfo") test fails on local runs because it expects
"HAVE_UNIBILIUM " in the :version info to mean that nvim was built
without unibilium.

Solution: Assume nvim is built with unibilium if HAVE_UNIBILIUM is
present in the version string and is NOT followed by 0, false, or off.

This isn't affecting CI runs because when the test detects that it is
running in CI it doesn't use the :version string at all.

Resolves https://github.com/neovim/neovim/issues/37456
2026-01-21 12:02:20 +08:00
zeertzjq
1949452bd3 fix(tui): avoid using uv_pipe_t as uv_tty_t (#37479)
Check tui->out_isatty before accessing tui->output_handle.tty.
2026-01-21 11:53:18 +08:00
Tommy Guo
103ddaf9ae fix(lua): correct line number reporting for options set in coroutines (#37463) 2026-01-21 02:18:33 +00:00
zeertzjq
d3aae6172a test: fix flaky tests (#37478)
* test(core/channels_spec): fix flaky test

Always use expect_stdout() to check PTY output.

* test(autocmd/termxx_spec): fix flaky test

Usually the Ctrl-C cancels the following :qa!, but sometimes it doesn't,
and Nvim exits before feed() returns. Instead make sure that :qa! always
reaches Nvim and use expect_exit().
2026-01-21 08:41:00 +08:00
zeertzjq
87276db7f9 vim-patch:9.1.2100: filetype: tiltfiles are not recognized (#37477)
Problem:  filetype: tiltfiles are not recognized
Solution: Detect Tiltfiles.* and *.tiltfiles as tiltfile  filetype.
          (Luis Davim)

Reference:
- https://docs.tilt.dev/api.html

fixes:  vim/vim#19214
closes: vim/vim#19218

ff0e5d994c

Co-authored-by: Luis Davim <luis.davim@gmail.com>
2026-01-21 07:34:51 +08:00
zeertzjq
68e0b1bd01 vim-patch:f338a2f: runtime(doc): Update [gnt]roff information (#37476)
Content:
* Refer to the formatter as "GNU troff".  Strictly, "groff" refers to
  several things.[1]  Since the context is the editing of input to the
  formatter, GNU's troff program is most relevant choice.
* Refer to groff as distributions' default "typesetting" rather than
  "text processing" package.  Many text processing tools exist, and some
  distributions (Alpine Linux, NetBSD, OpenBSD) have replaced groff with
  mandoc[2] as their man page formatter.
* Mention that Plan 9 still ships an AT&T-derived troff; they even
  maintain it.[3]
* Correct explanation of traditional `yr` register (1).  `\n(yr` is not
  a request, but an escape sequence.[4]
* Correct explanation of traditional `yr` register (2).  This register
  has not interpolated a "2-digit year" since the year 2000; it now
  interpolates a 3-digit one, because AT&T troff designed the `yr`
  register with a Y2K bug in it.[5]
* Fix scrambled terminology.  The phrase "macro request" confuses two
  separate things: macros and requests.[6]  Say instead "font, request,
  register, macro, and string names"; these are the formatter object
  types that people writing groff documents most often use.
* Refer to "groff's mm package" instead of "GNU mm".  Strictly, this
  package is in groff's "contrib" area, which implies that it's not
  official GNU product.  (To be fair, after shipping with groff for over
  34 years,[7] I'm not sure how much distinction anyone perceives.)
* Motivate the newly added advice preferring macro package facilities
  for paragraphing; this issue is distinct from aiding sentence boundary
  detection, which until recently[8] was the only advice offered here.

Style:
* Condense introductory paragraphs.
* Refer to "language syntax" rather than "language primitives".
* Use slightly more idiomatic English.

While these revisions convey more information, they leave the line count
unchanged.  I'll try to stop fooling with this material now.

Notes:
[1] https://cgit.git.savannah.gnu.org/cgit/groff.git/tree/man/groff.7.man?h=1.24.0.rc1#n303
[2] https://mandoc.bsd.lv/
[3] https://github.com/9fans/plan9port/pull/738
    4f3a4d8b3d
[4] https://www.gnu.org/software/groff/manual/groff.html.node/Formatter-Instructions.html
    https://github.com/mamccollum/troff-resources/blob/main/cstr-54.pdf
[5] Tellingly, groff added the `year` register in its 1.16 release,
    dated 2000-05-23.
    https://cgit.git.savannah.gnu.org/cgit/groff.git/tree/NEWS?h=1.24.0.rc1#n3650
    https://cgit.git.savannah.gnu.org/cgit/groff.git/tree/ChangeLog.116?h=1.24.0.rc1#n261
[6] https://www.gnu.org/software/groff/manual/groff.html.node/Requests-and-Macros.html
    https://www.gnu.org/software/groff/manual/groff.html.node/groff.html_fot.html#FOOT26
[7] https://cgit.git.savannah.gnu.org/cgit/groff.git/tree/NEWS?h=1.24.0.rc1#n4192
    https://cgit.git.savannah.gnu.org/cgit/groff.git/tree/ChangeLog.old?h=1.24.0.rc1#n2714
[8] 638bbc57c1

closes: vim/vim#19221

f338a2f1a6

Co-authored-by: G. Branden Robinson <g.branden.robinson@gmail.com>
2026-01-20 22:58:21 +00:00
zeertzjq
15b9118ac0 test: fail CI if .nvimlog is not empty (#37470)
This will prevent adding passing tests which logs errors in .nvimlog.

Close #28323
Related: https://github.com/neovim/neovim/pull/27660#issuecomment-2035738597

Co-authored-by: dundargoc <gocdundar@gmail.com>
2026-01-20 20:56:06 +08:00
zeertzjq
6da968dd7f test(core/server_spec): check error in logfile (#37469) 2026-01-20 06:57:10 +00:00
James Fotherby
bfe9fa0f8e fix(socket): remove stale socket files (#37378)
Problem:
Crashed Nvim leaves socket files. Subsequent starts fail with "address already in use".

Solution:
On bind failure, test socket liveness via connect(). Remove if stale, retry bind().

Fixes #36581
2026-01-20 13:59:43 +08:00
glepnir
0712a9c87b fix(pum): separate scrollbar from shadow border (#37448)
Problem:
With shadow border, scrollbar and border overlap. Shadow's right border
starts from the second row (offset by 1), but scrollbar renders on every
row including the first. If they share a column, the first row shows
scrollbar where shadow hasn't started yet, causing misalignment.

Solution:
Separate scrollbar from the shadow's right border.
2026-01-19 19:39:48 -08:00
zeertzjq
a9271f927f Merge pull request #37468 from zeertzjq/vim-d5f173c
vim-patch: runtime file updates
2026-01-20 08:22:31 +08:00
zeertzjq
fb7ac397aa vim-patch:4e2aafd: runtime(netrw): Do not create swapfiles in netrw buffers
Problem:  When using netrw to navigate directories, vim immediately
          creates, then deletes a swap file in the entered directory,
          causing the lastModifiedTime of that directory to change.
Solution: Use the :noswapfile command modifier in s:NetrwEditFile()

fixes: vim/vim#18854

4e2aafddbb

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-01-20 07:56:53 +08:00
zeertzjq
f728895edd vim-patch:d829e10: runtime(sml): add 'include' setting to ftplugin
closes: vim/vim#19156

d829e10e0f

Co-authored-by: Mateo Gjika <104777599+mateoxh@users.noreply.github.com>
2026-01-20 07:56:53 +08:00
zeertzjq
c0062da148 vim-patch:b1fa262: runtime(asm): add '#' as comment symbol (GNU as)
closes: vim/vim#19158

b1fa262960

Co-authored-by: Mateo Gjika <104777599+mateoxh@users.noreply.github.com>
2026-01-20 07:56:53 +08:00
zeertzjq
4fb8ba303c vim-patch:d5f173c: runtime(menu): fix space before Tab and trailing space
closes: vim/vim#19209

d5f173cf90
2026-01-20 07:56:50 +08:00
zeertzjq
64057d266c vim-patch:9.1.2098: Crash with 'wildmenu' when typing Ctrl-Y after Ctrl-A (#37466)
Problem:  Crash with 'wildmenu' when typing Ctrl-Y after Ctrl-A
          (after 9.1.1714) (fizz-is-on-the-way).
Solution: Check if there are matches before applying one (zeertzjq).

closes: vim/vim#19210

311b98d942
2026-01-19 23:36:57 +00:00
zeertzjq
8133760c98 test: add tests for #14379 2026-01-20 07:09:15 +08:00
zeertzjq
b4e602dde5 vim-patch:9.1.2095: :wqall! doesn't quit when using :quit in BufWritePost
Problem:  :wqall! doesn't quit when using :quit in BufWritePost
          (after 8.0.1190).
Solution: Restore old value of "exiting" when calling not_exiting()
          instead of always resetting it to FALSE (zeertzjq).

related: vim/vim#2205
closes:  vim/vim#19212

e803ad1c56
2026-01-20 07:09:15 +08:00
zeertzjq
933b99a2b1 Merge pull request #37464 from zeertzjq/vim-9.1.1202
vim-patch:9.1.{1202,1211,1325,2093,2097}: TabClosedPre
2026-01-20 07:01:21 +08:00
zeertzjq
7470e63260 vim-patch:9.1.2097: TabClosedPre may be triggered twice for the same tab page
Problem:  TabClosedPre may be triggered twice for the same tab page when
          closing another tab page in BufWinLeave (after 9.1.1211).
Solution: Store whether TabClosedPre was triggered in tabpage_T
          (zeertzjq).

Also fix the inconsistency that :tabclose! triggers TabClosedPre after
a failed :tabclose, but :close! doesn't even if there is only one window
in the tab page.

closes: vim/vim#19211

9168a04e0c
2026-01-20 06:23:11 +08:00
zeertzjq
30bcb25341 vim-patch:9.1.2093: heap-use-after-free when wiping buffer in TabClosedPre
Problem:  heap-use-after-free when wiping buffer in TabClosedPre.
Solution: Check window_layout_locked() when closing window(s) in another
          tabpage (zeertzjq).

closes: vim/vim#19196

8fc7042b3d
2026-01-20 06:23:11 +08:00
zeertzjq
da20804a6a vim-patch:9.1.1325: tests: not checking error numbers properly
Problem:  tests: not checking error numbers properly.
Solution: Add a trailing comma to avoid matching a different error
          number with the same prefix (zeertzjq)

closes: vim/vim#17159

67fe77d272
2026-01-20 06:23:11 +08:00
zeertzjq
0d3ed7904a vim-patch:9.1.1211: TabClosedPre is triggered just before the tab is being freed
Problem:  TabClosedPre is triggered just before the tab is being freed,
          which limited its functionality.
Solution: Trigger it a bit earlier and also on :tabclose and :tabonly
          (Jim Zhou)

closes: vim/vim#16890

bcf66e0141

Co-authored-by: Jim Zhou <jimzhouzzy@gmail.com>
2026-01-20 06:23:11 +08:00
zeertzjq
eb86bbf83a vim-patch:b55f022: runtime(vim): Sync syntax generator base file with output file.
Synchronisation was lost in commit 0fab891 and the error propagated to
the output file in commit 5606ca5.

closes: vim/vim#16889

b55f0221cc

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2026-01-20 06:23:11 +08:00
zeertzjq
e3990f8643 vim-patch:9.1.1202: Missing TabClosedPre autocommand
Problem:  Missing TabClosedPre autocommand
          (zoumi)
Solution: Add the TabClosedPre autcommand (Jim Zhou).

fixes: vim/vim#16518
closes: vim/vim#16855

5606ca5349

Co-authored-by: Jim Zhou <jimzhouzzy@gmail.com>
2026-01-20 06:23:11 +08:00
zeertzjq
df65f87fd7 vim-patch:partial:8.2.3149: some plugins have a problem with the error check
Problem:    Some plugins have a problem with the error check for using
            :command with -complete but without -nargs.
Solution:   In legacy script only give a warning message.

cc7eb2aa7a

Align tests with Vim only.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-01-20 06:23:10 +08:00
luukvbaal
8bdfd286e5 fix(messages): adjust msg_show "empty" kind logic (#37427)
Problem:  A message ending in an unprintable character may emit a
          msg_show event with the "empty" kind. No empty message event
          for echom "".
Solution: Adjust conditions for emitting "empty" msg_show events.
2026-01-19 17:15:44 +01:00
zeertzjq
30259d6af7 Merge pull request #37459 from zeertzjq/vim-658cc10
vim-patch: runtime file updates
2026-01-19 07:24:50 +08:00
zeertzjq
069a5ef8e0 vim-patch:0b103d6: runtime(haskell): add include-search and define support in ftplugin
closes: vim/vim#19143

0b103d6a7c

Co-authored-by: Mateo Gjika <104777599+mateoxh@users.noreply.github.com>
2026-01-19 07:02:22 +08:00
zeertzjq
a71ea81b86 vim-patch:638bbc5: runtime(doc): Update advice for [gnt]roff users
Content:
* Offer more specific guidance regarding input line breaks and sentence
  endings.
* Advise what to do when a line ends with sentence-ending punctuation
  but doesn't end a sentence.
* Advise against use of blanks lines and leading spaces for formatting
  when a macro package is in use.
* Advise how to achieve visual separation in the document without
  affecting formatting.
* Point out how the newline/end-of-sentence rules aid diffing.
* Distinguish the separate processes of inter-sentence space
  supplementation and filling.
* Use conventional (but accessible) terms from typography instead of
  more casual, approximate ones.
* Clarify what sort of extension the ms package's `XP` macro is.

Style:
* Fix comma splice with a semicolon.
* Use slightly more standard/idiomatic English.

Sources:
* https://rhodesmill.org/brandon/2012/one-sentence-per-line/
* https://www.ualberta.ca/en/computing-science/media-library/docs/unix-beginners.pdf
  (p. 20)
* https://www.gnu.org/software/groff/manual/groff.html.node/Input-Conventions.html
* https://cgit.git.savannah.gnu.org/cgit/groff.git/tree/doc/ms.ms?h=1.23.0#n1131
* https://docs-archive.freebsd.org/44doc/usd/18.msdiffs/paper.pdf

closes: vim/vim#19193

638bbc57c1

Co-authored-by: G. Branden Robinson <g.branden.robinson@gmail.com>
2026-01-19 07:01:58 +08:00
zeertzjq
3bbd646f59 vim-patch:617bf46: runtime(doc): Tweak documentation style in {ft_context,terminal}.txt
closes: vim/vim#19199

617bf466bb

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2026-01-19 06:57:35 +08:00
zeertzjq
095fb2abd8 vim-patch:658cc10: runtime: Changed old "Sponsor" menu item name to a new one
Problem:  There is an unavailable "Sponsor/Register" item in the Help
          menu.
Solution: The item name has been unified to "Sponsor".

The item names of tlmenu, which are only valid in terminal mode, were
not updated, so unnecessary items that were unavailable were displayed.

This item is also very confusing when creating menu translations.

In addition, the indentation of an item with the same name in the
regular menu has been corrected.

closes: vim/vim#19201

658cc102f6

Co-authored-by: Muraoka Taro <koron.kaoriya@gmail.com>
2026-01-19 06:52:14 +08:00
zeertzjq
3264dfee75 vim-patch:9.1.1989: Vim intro screen shows register message
Problem:  Vim intro screen shows register message (after v9.1.1893)
Solution: Remove the register message, registering is no longer useful
          and possible.

fixes:  vim/vim#18933
closes: vim/vim#18934

Signed-off-by:

ca12f62d0a

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-01-19 06:51:47 +08:00
Christian Clason
c52f6eb49a vim-patch:9.1.2094: filetype: tiger files are not recognized
Problem:  filetype: tiger files are not recognized
Solution: Detect *.tig files as tiger filetype
          (Christian Clason).

Reference:
- https://www.cs.princeton.edu/~appel/modern/

closes: vim/vim#19202

eb53ed5de0

Co-authored-by: Christian Clason <c.clason@uni-graz.at>
2026-01-18 23:33:22 +01:00
Emanuel Krollmann
f36dd7557a fix(autocmd): heap UAF with :bwipe in Syntax autocmd
Problem:
Creating an autocommand which executes `:bwipe` on the Syntax event
causes a heap-use-after-free.

Solution: set BF_SYN_SET flag before applying autocommands
2026-01-18 17:56:34 +00:00
glepnir
5a65321684 fix(pum): text overflows into border on truncation (#37438)
Problem:
When text is too long, it overflows into the border. This happens because
grid_line_maxcol includes border columns, so grid_line_puts can write
there.

Solution:
Truncate string to available width when need_fcs_trunc is set.
2026-01-18 08:55:30 +00:00
zeertzjq
41068c77aa fix(normal): assertion failure with "gk" in narrow window (#37444)
When width1 and width2 are negative the assertion may fail. It seems
that adding a negative value to w_curswant won't cause any problems, so
just change the assertion.
2026-01-18 11:46:13 +08:00
Sean Dewar
a5e5ec8910 fix(api): parse_expression crash with unopened ] and node
Problem: nvim_parse_expression null pointer dereference with unmatched ]
followed by a node.

Solution: if ast_stack was empty, set new_top_node_p to top of the stack after
pushing the list literal node; similar to what's done for curlies.

This bug was originally found by a Matrix user, but I couldn't remember how to
trigger it... Ran into the other crash while finding a repro. :P
2026-01-17 13:22:55 +00:00
Sean Dewar
5226801be2 fix(api): parse_expression crash with ident and curly
Problem: nvim_parse_expression null pointer dereference when parsing an
identifier followed by { with "highlight" parameter set to false.

Solution: only set opening_hl_idx if pstate->colors is not NULL.

Not added to parser_tests.lua as that uses highlight = true.
2026-01-17 13:22:55 +00:00
zeertzjq
f3cfe9a94b vim-patch:8.2.0371: crash with combination of terminal popup and autocmd (#37433)
Problem:    Crash with combination of terminal popup and autocmd.
Solution:   Disallow closing a popup that is the current window.  Add a check
            that the current buffer is valid. (closes vim/vim#5754)

cee52204ca

Cherry-pick related changes from patch 9.0.1454.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-01-17 11:53:58 +00:00
zeertzjq
b4ce549f2a Merge pull request #37431 from zeertzjq/vim-9.1.2087
vim-patch:9.1.{2087,2090}
2026-01-17 19:01:09 +08:00
zeertzjq
960cba7b3b vim-patch:9.1.2090: Last buffer not freed with EXITFREE
Problem:  Last buffer not freed with EXITFREE (after 9.1.2087).
Solution: Free the last buffer when inside free_all_mem()
          (zeertzjq).

This isn't really a memory leak, as the last buffer's memory is still
reachable via pointers like firstbuf and lastbuf. But it's possible that
this may cause false ASAN warnings in the future, which is what EXITFREE
is supposed to prevent.

closes: vim/vim#19194

6c118afeaa
2026-01-17 18:37:48 +08:00
zeertzjq
eb5a7cc0dd vim-patch:9.1.2087: Crash when using :tabonly in BufUnload
Problem:  Crash when using :tabonly in BufUnload.
Solution: Set curbuf when setting curwin->w_buffer. Don't wipe out a
          buffer if there are no other buffers. Don't decrement
          b_nwindows if it was 0 before buf_freeall() (zeertzjq).

fixes:  vim/vim#19088#issuecomment-3710172769
closes: vim/vim#19186

fa64f92f6a
2026-01-17 18:37:47 +08:00
Christian Clason
06e4b159ed fix(health): show full curl output
Problem: The health check for `curl` strips the first line of the
version output, which contains potentially useful information.

Solution: Only trim empty lines.
2026-01-17 11:28:00 +01:00
zeertzjq
e51f5e17e1 vim-patch:9.0.0909: error message for layout change does not match action (#37436)
Problem:    Error message for layout change does not match action.
Solution:   Pass the command to where the error is given. (closes vim/vim#11573)

9fda81515b

Thinking about this again, it's actually OK to check split_disallowed in
window_layout_locked(), so add the check.
Also add missing window_layout_locked() in tabpage_close().

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-01-17 10:58:26 +08:00
zeertzjq
8754118213 test: remove duplicate test (#37434)
This test is a copy of Test_bufunload_all() and requires too much
additional cleanup for the Windows log message.
2026-01-17 08:31:18 +08:00
zeertzjq
03494ad048 vim-patch:9.1.2088: Redundant NULL checks in find_pattern_in_path() (#37432)
Problem:  Redundant NULL checks in find_pattern_in_path().
Solution: Remove the NULL checks. Also fix typos in test_diffmode.vim
          (zeertzjq).

After assigning to inc_opt on line 2976, it's dereferenced immediately,
and not assigned another value afterwards, so checking for NULL after
line 2977 is redundant.

closes: vim/vim#19185

ce394b13e9
2026-01-17 06:34:34 +08:00
zeertzjq
dde914f926 Merge pull request #37422 from zeertzjq/vim-9.1.0059
vim-patch:9.1.{0059,0117,0671,1043,partial:1110}: WinNewPre
2026-01-16 16:18:02 +08:00