34807 Commits

Author SHA1 Message Date
Jan Edmund Lazo
60a0e3d0a0 vim-patch:9.1.0151: ml_get_buf_len() does not consider text properties (#37094)
Problem:  ml_get_buf_len() does not consider text properties
          (zeertzj)
Solution: Store text length excluding text properties length
          in addition in the memline

related vim/vim#14123
closes: vim/vim#14133

a72d1be5a9

--------

Replace ml_line_len with ml_line_textlen to be explicit
that Nvim doesn't currently support Vim's text properties
and Nvim doesn't support lines with "ambiguous" length.

--------

vim-patch:9.1.0153: Text properties corrupted with fo+=aw and backspace

Problem:  Text properties corrupted with fo+=aw and backspace
Solution: Allocate line and move text properties
          (zeertzjq)

closes: vim/vim#14147

7ac1145fbe

vim-patch:9.1.0163: Calling STRLEN() to compute ml_line_textlen when not needed

Problem:  Calling STRLEN() to compute ml_line_textlen when not needed.
Solution: Use 0 when STRLEN() will be required and call STRLEN() later.
          (zeertzjq)

closes: vim/vim#14155

82e079df81

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2025-12-25 15:38:45 +08:00
Sean Dewar
1cde71233f fix(autocmd): skip empty comma-separated patterns properly
Problem: empty comma-separated patterns in an aupat aren't skipped correctly.
Solution: skip consecutive commas in an aupat.

Also simplify the logic.
nightly
2025-12-25 00:08:57 +00:00
Sean Dewar
6d2330f50d fix(autocmd): parsing of comma-separated buflocal patterns
Problem: patterns after a buffer-local pattern in a comma-separated aupat are
         ignored.
Solution: ensure pat refers to the original buffer after each pattern, not the
          buflocal_pat buffer, and when printing make sure it's normalized for
          each pattern, not just the first.

Also simplify the logic when printing all autocommands for an event, and ensure
headings aren't repeated for each event when printing autocommands.
2025-12-25 00:08:57 +00:00
zeertzjq
ce7ed53fba Merge pull request #37082 from janlazo/vim-9.1.0973
vim-patch:9.1.{974,1491},vim-patch:partial:9.1.973
2025-12-24 14:42:00 +08:00
Jan Edmund Lazo
ee717447dd vim-patch:9.1.1491: missing out-of-memory checks in cmdexpand.c
Problem:  missing out-of-memory checks in cmdexpand.c
Solution: add out-of-memory checks for expand_files_and_dirs(),
          ExpandUserDefined() and ExpandUserList()
          (John Marriott)

closes: vim/vim#17570

3b03b435a2

Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-12-24 01:00:54 -05:00
Jan Edmund Lazo
9cc93b6def vim-patch:9.1.0974: typo in change of commit v9.1.0873
Problem:  typo in change of commit v9.1.0873
          (Christ van Willegen)
Solution: Add back the square brackets
          (John Marriott)

closes: vim/vim#16340

df4b3ca5dc

Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-12-24 01:00:54 -05:00
Jan Edmund Lazo
3f62fe4bd8 vim-patch:partial:9.1.0973: too many strlen() calls in fileio.c
Problem:  too many strlen() calls in fileio.c
Solution: refactor fileio.c and remove calls to STRLEN(),
          check for out-of-memory condition in buf_check_timestamp()
          (John Marriott)

closes: vim/vim#16306

14ede1890f

Full port requires v8.2.0988 to update readdir_core().

Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-12-24 00:59:31 -05:00
zeertzjq
d7b882697b vim-patch:9.1.2017: getregionpos() depends on 'linebreak' setting (#37088)
Problem:  getregionpos() depends on 'linebreak' setting
Solution: Reset linebreak setting temporarily (McAuley Penney)

When a line is wrapped on word boundaries, getregionpos() may report a
different end column for a visual block than the cursor position used to
define the selection.

Update the blockwise calculation in getregionpos() to use the same
wrapping assumptions as visual block mode, so the reported region
matches the selection boundaries.

Add a regression test that forces wrapping and checks that the end
position stays consistent under "setlocal wrap" and "setlocal
linebreak".

closes: vim/vim#19006

8ea0e7205c

Co-authored-by: McAuley Penney <jacobmpenney@gmail.com>
2025-12-24 09:48:59 +08:00
zeertzjq
2a2c366a3e vim-patch:9.1.2016: cindent wrong indentation after do-while loop (#37087)
Problem:  At "if(0) do if(0); while(0); else", else should be aligned
          with outer if, but is aligned with inner if.
Solution: In function find_match, ignore "if" and "else" inside a
          do-while loop, when looking for "if". (Anttoni Erkkilä)

closes: vim/vim#19004

9d661b057e

Co-authored-by: Anttoni Erkkilä <anttoni.erkkila@protonmail.com>
2025-12-24 09:43:42 +08:00
zeertzjq
855fda03aa Merge pull request #37086 from zeertzjq/vim-5e577c7
vim-patch: runtime file updates
2025-12-24 09:12:48 +08:00
zeertzjq
20c96f1515 vim-patch:2006415: runtime(doc): add reference to searchcount() function
2006415016

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-12-24 08:53:31 +08:00
zeertzjq
0981d4e871 vim-patch:6d211bc: runtime(doc): Improve :catch documentation
fixes: vim/vim#18984

6d211bc4f0

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-12-24 08:52:21 +08:00
zeertzjq
5681315b82 vim-patch:519dc39: runtime(make): Makefile highlighting breaks with ')' in string
Problem:  Makefile syntax highlighting incorrectly ends function calls
          when encountering ')' inside double or single quoted strings,
          causing incorrect highlighting for the remainder of the line.
Solution: Add makeDString and makeSString to the contains list for
          makeIdent regions. This allows strings to be recognized inside
          variable references and function calls.

fixes:  vim/vim#18687
closes: vim/vim#18818

519dc391d8

Co-authored-by: Beleswar Prasad Padhi <beleswarprasad@gmail.com>
2025-12-24 08:45:21 +08:00
zeertzjq
081feae3a3 vim-patch:aded554: runtime(make): Move target greedy match after $() to avoid region matching overflow
Partially revert 2a33b499a3d7f46dc307234847a6562cef6cf1d8, where all
syn match makeIdent are moved before syn region makeIdent to match $()
(reason: see https://github.com/vim/vim/pull/18403#issuecomment-3341161566)

However this results in https://github.com/vim/vim/issues/18890 ,
because lines like
`$(a) =`
will first start a region search beginning with `$(`
but then the whole target including `)` will be matched by
`syn match makeIdent "^ *[^:#= \t]*\s*="me=e-1`
which leaves the region search for the never-found `)` and let the
region matching overflow.

Same for

`$(a) ::`
`$(a) +=`

The solution is to move those greedy target match back, so they take
priority and prevents region match from happening.

fixes:  vim/vim#18890
closes: vim/vim#18938

aded55463a

Co-authored-by: Yiyang Wu <xgreenlandforwyy@gmail.com>
2025-12-24 08:45:05 +08:00
zeertzjq
dfcf03b1ba vim-patch:5e577c7: runtime(ftplugin): set different formatoptions for bpftrace
Problem:   Comment formatting does not work by default for bpftrace.
Solution:  Change default 'formatoptions' similarly as C and many other
           languages.

closes: vim/vim#18996

5e577c7aa8

Co-authored-by: Stanislaw Gruszka <stf_xl@wp.pl>
2025-12-24 08:44:51 +08:00
phanium
1aa26f5d55 fix(lua): separate vim.{g,b,w,t} types #37081
Problem:
When `vim.g.foo = 1`, `vim.b.foo` also appears as
a completion candidate (when use emmylua_ls).

Solution:
Define separate types.
2025-12-23 10:39:22 -05:00
zeertzjq
c374d78095 test(ui/inccommand_spec): don't check for transient message (#37078)
The check for v:errmsg is enough.
2025-12-23 08:15:32 +08:00
zeertzjq
f93f341867 vim-patch:7982966: runtime(bpftrace): add base syntax plugin (#37077)
Problem:  No syntax highlighting for bpftrace files.
Solution: Add basic syntax rules, which cover comments, keywords, strings,
          numbers, macros and probes (the bpftrace specific items).

closes: vim/vim#18999

7982966f3e

Co-authored-by: Stanislaw Gruszka <stf_xl@wp.pl>
2025-12-23 00:00:28 +00:00
zeertzjq
49b1a6540f vim-patch:9.1.2009: tests: "Xm4" test directory may not be deleted
Problem:  tests: "Xm4" test directory may not be deleted
Solution: Use "R" flag with mkdir() call to have the directory
          recursively deleted at the end of function Test_m4_format()
          (Muraoka Taro)

Test_m4_format in test_filetype.vim creates the "Xm4" directory with the
'D' flag. Then it creates two files in the "Xm4" directory. One of them,
"alocal.m4," was created with the 'D' flag, so it will disappear after
the test is complete. However, the other, "configure.ac," was created
without any flags, so it will remain even after the test is complete.
Because the parent directory "Xm4" was created with the 'D' flag, the
latter "configure.ac" remains and is not empty, so it will not be
deleted.

This forces the directory to be deleted regardless of its contents. As a
result, the two files "alocal.m4" and "configure.ac" created in the
directory are no longer needed, so they have been deleted.

closes: vim/vim#18995

de37e7430a

Co-authored-by: Muraoka Taro <koron.kaoriya@gmail.com>
2025-12-23 07:20:37 +08:00
zeertzjq
471be48d56 vim-patch:9.1.2008: filetype: hylo files are not recognized
Problem:  filetype: hylo files are not recognized
Solution: Detect *.hylo files as hylo filetype (Ambrus Tóth)

References:
- https://hylo-lang.org/

closes: vim/vim#18994

9c9982240a

Co-authored-by: Ambrus Tóth <ping@ambrus.dev>
2025-12-23 07:20:37 +08:00
zeertzjq
92910a8ab8 vim-patch:9.1.2007: filetype: bpftrace hashbang lines are not recognized
Problem:    bpftrace files are not recognized from the hashbang line.
Solution:   Add a hashbang check (Stanislaw Gruszka)

closes: vim/vim#18992

f2814754c0

Co-authored-by: Stanislaw Gruszka <stf_xl@wp.pl>
2025-12-23 07:20:37 +08:00
zeertzjq
a979a6237e vim-patch:8.2.4785: Visual mode not stopped if win_gotoid() goes to other buffer (#37073)
Problem:    Visual mode not stopped early enough if win_gotoid() goes to
            another buffer. (Sergey Vlasov)
Solution:   Stop Visual mode before jumping to another buffer. (closes vim/vim#10217)

3aca0916f0

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-12-22 20:31:07 +08:00
Jaehwang Jung
033f1123cd fix(marks): wrong line('w$', win) with conceal_lines (#37047)
Background:
Suppose a window has concealed lines, and sets conceallevel>2,
concealcursor="". The concealed lines are displayed if the window is
curwin and the cursor is on the those lines.

Problem:
line('w$', win) switches curwin to win, and then does validate_botline
for curwin. It computes botline assuming the concealed lines displayed,
resulting in a smaller value than the actual botline that the user sees.

Solution:
Evaluate line('w$', win) without switching curwin.
Apply similar changes to other functions that switches curwin.

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2025-12-22 09:03:50 +00:00
Rob Pilling
8d3742ae8d vim-patch:8.2.1679: ":*" is not recognized as a range (#37052)
Problem:    Vim9: ":*" is not recognized as a range.
Solution:   Move recognizing "*" into skip_range(). (closes vim/vim#6938)

3bd8de40b4

Co-authored-by: Bram Moolenaar <Bram@vim.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2025-12-22 16:49:57 +08:00
zeertzjq
2b766e1f4d Merge pull request #37068 from janlazo/vim-9.0.0154
vim-patch:9.0.{154,1899}
2025-12-22 14:14:21 +08:00
Jan Edmund Lazo
1afdcb8f2b vim-patch:9.0.1899: potential buffer overflow in PBYTE macro
Problem:  potential buffer overflow in PBYTE macro
Solution: Check returned memline length

closes: vim/vim#13083

the PBYTE macro is used to put byte c at a position lp of the returned
memline. However, in case of unexpected errors ml_get_buf() may return
either "???" or an empty line in which case it is quite likely that we
are causing a buffer overrun.

Therefore, switch the macro PBYTE (which is only used in ops.c anyhow)
to a function, that verifies that we will only try to access within the
given length of the buffer.

Also, since the macro is only used in ops.c, move the definition from
macros.h to ops.c

ffb13674d1

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-12-22 00:17:09 -05:00
Jan Edmund Lazo
efacb10709 vim-patch:9.0.0154: text properties wrong after splitting a line
Problem:    Text properties wrong after splitting a line.
Solution:   Check for text properties after the line. (closes vim/vim#10857)

7d0f7e9524

textprop is N/A.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-12-21 23:36:57 -05:00
zeertzjq
b95848a8f1 vim-patch:8.2.1756: Vim9: :let will soon be disallowed (#37063)
Problem:    Vim9: :let will soon be disallowed.
Solution:   Add v:disallow_let temporarily.  Fix tests.

cfcd011fcd

The change to use checkforcmd() is already included in the port of patch
9.0.1505. This commit adds the missing :const check.

N/A patches:
vim-patch:8.2.1397: Vim9: return type of maparg() not adjusted for fourth arg
vim-patch:8.2.1623: Vim9: using :call where it is not needed
vim-patch:8.2.1766: Vim9: Some tests are still using :let
vim-patch:8.2.1788: Vim9: still allows :let for declarations
vim-patch:8.2.1882: Vim9: v:disallow_let is no longer needed

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-12-22 12:31:44 +08:00
zeertzjq
6c7a5eff1d Merge pull request #37041 from janlazo/vim-8.2.1667
vim-patch:8.2.{223,1667,2992,3377,3383,3431,3657,4548}
2025-12-22 11:45:34 +08:00
Jan Edmund Lazo
398cf6d8d3 vim-patch:8.2.3657: Vim9: debug text misses one line of return statement
Problem:    Vim9: debug text misses one line of return statement.
Solution:   Add a line when not at a debug instruction. (closes vim/vim#9137)

112bed0cbe

Vim9 test "Test_Debugger_break_at_return()" commented out
to avoid unexpected side-effects even if all other tests pass.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-12-21 21:39:34 -05:00
Jan Edmund Lazo
3fc3f5f194 vim-patch:8.2.0223: some instructions not yet tested
Problem:    Some instructions not yet tested.
Solution:   Disassemble more instructions.  Move tests to a new file.  Compile
            call to s:function().

5cab73f8cc

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-12-21 21:17:34 -05:00
Jan Edmund Lazo
4f71d9ce35 vim-patch:8.2.3383: Vim9: completion for :disassemble adds parenthesis
Problem:    Vim9: completion for :disassemble adds parenthesis.
Solution:   Don't add parenthesis. (Naohiro Ono, closes vim/vim#8802)

9aecf79c45

Co-authored-by: naohiro ono <obcat@icloud.com>
2025-12-21 21:17:34 -05:00
Jan Edmund Lazo
cd25ca5e0c vim-patch:8.2.3377: Vim9: :disass completion does not understand "s:"
Problem:    Vim9: :disass completion does not understand "s:".
Solution:   Expand "s:" to a pattern. (closes vim/vim#8780)

47016f5772

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-12-21 21:17:33 -05:00
Jan Edmund Lazo
525c348c29 vim-patch:8.2.2992: Vim9: completion for :disassemble is incomplete
Problem:    Vim9: completion for :disassemble is incomplete.
Solution:   Recognize the "debug" and "profile" arguments.

4ee9d8e04d

Vim9 ":disassemble" is N/A.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-12-21 21:17:33 -05:00
Jan Edmund Lazo
e0dcdef181 vim-patch:8.2.3431: completion for :disas sorts local functions first
Problem:    Completion for :disas sorts local functions first.
Solution:   Sort local functions last, like with :delfunc. (Naohiro Ono,
            closes vim/vim#8860)

dfe04dbff5

Vim9 ":disassemble" is N/A
but "commented" test code is a hint for future patches.

Co-authored-by: naohiro ono <obcat@icloud.com>
2025-12-21 21:17:33 -05:00
Jan Edmund Lazo
2ba44af7e0 vim-patch:8.2.4548: script-local function is deleted when used in a funcref
Problem:    Script-local function is deleted when used in a funcref.
Solution:   Do not consider a function starting with "<SNR>" reference
            counted. (closes vim/vim#9916, closes vim/vim#9820)

fb43cfc2c6

Co-authored-by: Bram Moolenaar <Bram@vim.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2025-12-21 21:17:26 -05:00
Jan Edmund Lazo
ffb4526376 vim-patch:8.2.1667: local function name cannot shadow a global function name
Problem:    Local function name cannot shadow a global function name.
Solution:   Ignore global functions when checking a script-local or scoped
            function name. (closes vim/vim#6926)

0f769815c8

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-12-21 21:12:26 -05:00
zeertzjq
e1aceb0068 vim-patch:e09ff34: runtime(ty): include ty compiler plugin (#37066)
closes: vim/vim#18960

e09ff34129

Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
2025-12-22 08:13:20 +08:00
Sean Dewar
d1189ea508 fix(window): win_move_after UAF from naughty autocmds (#37065)
Problem: use-after-free in win_move_after if win_enter autocommands free win1/2.
Solution: set w_pos_changed before calling win_enter.
2025-12-21 20:31:05 +00:00
Sean Dewar
a2b9720939 fix(api): open_win leak from naughty autocommands
Problem: error set by win_set_buf may leak if autocommands immediately close the
new window.

Solution: free the error set by win_set_buf. (prefer nvim_open_win's error as
it's more important and will cause 0 to be returned)
2025-12-21 15:35:30 +00:00
Sean Dewar
d788864cde fix(api): ignore split_disallowed when opening a float
Problem: split_disallowed seemingly exists to prevent issues from changing
frames to accomodate a split window, which doesn't apply to floats.

Solution: remove the restriction for nvim_open_win, but only for floats.
(continue to check b_locked_split though)

NOTE: like before, the buffer we check b_locked_split for may not actually be
the target buffer "buf", as the later call to win_set_buf can fail to switch to
"buf" due to autocommands. (among other things)

Maybe we could attempt to close the new window in that case (or switch to a
different buffer if that also fails), but this is safer. (and simpler)

Fixes #36857 (and possibly some spurious E242s I've observed from extui)
2025-12-21 15:35:30 +00:00
Jaehwang Jung
756e1eb017 fix(treesitter.foldexpr): duplicate callbacks #37048
Problem:
VimEnter clears foldinfo, so register_cbs is called again after
VimEnter. The duplicate parser callbacks break incremental fold
computation.

Solution:
Check if the callbacks are already registered.
2025-12-21 00:47:46 -05:00
Justin M. Keyes
0d206da461 Merge #37057 docs 2025-12-21 00:22:36 -05:00
Olivia Kinnear
ad330e99d1 fix(statusline): diagnostics spacing #36897 2025-12-20 23:58:38 -05:00
zeertzjq
acecdbff1f fix(api,lua): handle converting NULL funcref/partial (#37060)
This fixes the Coverity warnings.
2025-12-21 11:41:33 +08:00
Justin M. Keyes
4485e715fb fix(options): deprecate 'gdefault', 'magic' 2025-12-20 22:07:27 -05:00
Justin M. Keyes
060993e438 docs: misc, lsp 2025-12-20 22:07:27 -05:00
zeertzjq
f89558848b vim-patch:9.1.2001: cursor may end up in wrong window after :botright copen (#37056)
Problem:  After :botright copen and closing the quikfix window, the
          cursor ends up in the wrong window. The problem is fr_child
          always points to the first (leftmost for FR_ROW, topmost for
          FR_COL) child frame. When do :vsplit, the new window is
          created on the left, and frame_insert() updates the parent's
          fr_child to point to this new left window.
Solution: Create a snapshot before open the quickfix window and restore
          it when close it (glepnir).

closes: vim/vim#18961

b43f9ded7e

Co-authored-by: glepnir <glephunter@gmail.com>
2025-12-21 10:41:53 +08:00
github-actions[bot]
69167006a4 docs: update version.c #36917
vim-patch:3a113e04d nsis: add Chinese translation to nsis installer
vim-patch:e1ea10a0a CI: Bump actions/cache from 4 to 5
vim-patch:9.0.1144: reading beyond text
vim-patch:9.0.1669: Crash syncing swapfile in new buffer when using sodium crypt
vim-patch:9.1.1977: MS-Windows: missing dependency on optiondefs.h in Make_cyg_ming.mak
vim-patch:9.1.1990: tests: Test_term_gettty() fails when using conpty on Windows
vim-patch:9.1.1997: Missing out-of-memory check in vim9class.c
vim-patch:9.1.1273: Coverity warns about using uninitialized value

vim-patch:8.2.0419: various memory leaks in Vim9 script code
vim-patch:8.2.0881: compiler warning for argument type
vim-patch:8.2.1532: compiler warning for conversion of size_t to long
vim-patch:8.2.1839: Vim9: memory leaks reported in assign test
vim-patch:8.2.2299: Vim9: invalid memory access making error message flaky
vim-patch:8.2.2673: Vim9: script-local funcref can have lower case name
vim-patch:8.2.3132: compiler warns for size_t to colnr_T conversion
vim-patch:8.2.3224: cannot call script-local function after :vim9cmd
2025-12-20 21:22:30 -05:00
Justin M. Keyes
81e2d2ea53 Merge #37033 from justinmk/testdelay 2025-12-20 19:52:40 -05:00