Problem:
`inputlist()` advertises "click with the mouse" purely because it
implements click selection, so under the default `'mouse'` of "nvi" it
offers a click that command-line mode never receives.
Solution:
Only offer the mouse when `'mouse'` covers command-line mode, the same
condition `:help inputlist()` already documents.
Problem:
vim.diagnostic.set() defers extmark position computation for an
unloaded buffer via a once=true BufRead autocmd, registering a new one
on every call without replacing the previous one. Each pending autocmd
also retains that call's diagnostics.
Solution:
Instead of registering an autocmd per set() call, register a single
static BufRead autocmd that computes positions from the diagnostic
cache for any buffer with cached diagnostics when it is read. This
removes the per-call registration entirely (nothing left to
accumulate) and means diagnostics cleared while the buffer was
unloaded no longer produce stale extmarks.
Use "fromstart" syncing.
Pragment regions are delimited by shared start/end tokens which render
other syncing types largely useless. A sync point located in the middle
of a multiline comment cannot distinguish the end token from a start
token and the erroneously created region runs to EOF.
closes: vim/vim#2103290a9a8c752
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Problem: u_read_undo() has comments that do not add anything to what
the code says (afte rv9.2.0935).
Solution: Drop the redundant comments (Hirohito Higashi).
related: vim/vim#20942
closes: vim/vim#21028ecfea491aa
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Problem: The duplicate-check hashtab in insexpand.c has comments that
do not add anything to what the code says (after v9.2.0909).
Solution: Drop the redundant comments.
related: vim/vim#20926
closes: vim/vim#210274dde4afa1d
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Problem: transstr() has comments that do not add anything to what the
code says, and it casts a length to int only to cast it back to
size_t.
Solution: Drop the comments and keep the length in a size_t
(Hirohito Higashi).
related: vim/vim#20925
closes: vim/vim#21026fe65307d49
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Problem: The comments on the precomputed sort keys explain the code by
contrasting it with the previous implementation, and one of
them exceeds 80 columns (after v9.2.0937).
Solution: Drop the redundant comments and shorten the union member ones
(Hirohito Higashi).
related: vim/vim#21003
closes: vim/vim#21030722f4292e5
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
vim-patch:8.1.1523: cannot show range of buffer lines in popup window
vim-patch:8.1.1537: using "tab" for popup window can be confusing
vim-patch:8.1.1538: cannot specify highlighting for notifications
vim-patch:8.1.1548: popup_dialog() is not implemented
vim-patch:8.1.1553: not easy to change the text in a popup window
vim-patch:8.1.1559: popup window title property not implemented yet
vim-patch:8.1.1574: tabpage option not yet implemented for popup window
vim-patch:8.1.1659: popup window "mousemoved" values not correct
vim-patch:8.1.1673: cannot easily find the popup window at a certain position
vim-patch:8.1.1690: default padding for popup window menu is too much
vim-patch:8.1.1944: leaking memory when using sound callback
vim-patch:8.1.1999: calling both PlaySoundW() and PlaySoundA()
vim-patch:8.1.2193: popup_setoptions(popup_getoptions()) does not work
vim-patch:8.1.2250: CTRL-U and CTRL-D don't work in popup window
vim-patch:8.1.2292: v:mouse_winid not set on click in popup window
vim-patch:8.2.0238: MS-Windows: job_stop() results in exit value zero
vim-patch:8.2.0286: cannot use popup_close() for a terminal popup
vim-patch:8.2.2105: sound test is a bit flaky
vim-patch:8.2.2296: cannot use CTRL-N and CTRL-P in a popup menu
vim-patch:8.2.2950: sound code not fully tested
vim-patch:8.2.2959: sound_playfile() is not tested on MS-Windows
vim-patch:9.0.0800: compiler complains about repeated typedef
vim-patch:9.0.0999: memory may leak
vim-patch:9.0.2089: sound_playfile() fails when using powershell
vim-patch:9.1.0271: CI sound test aborts with undefined variable
vim-patch:9.1.0949: popups inconsistently shifted to the left
vim-patch:1f045f324 runtime(doc): clarify buffer deletion on popup_close()
vim-patch:9.1.1985: tests: test_sound.vim fails on Windows
vim-patch:3d863d6aa runtime(doc): Update popup width rule
vim-patch:9.2.0928: MinGW: tests hang when Vim is built with coverage enabled
vim-patch:9.2.0940: GTK4: columns are lost when a scrollbar appears
vim-patch:9.2.0943: test: test_hardcopy fails on GTK4 UI
vim-patch:c6b041c63 CI: Keep the GTK4 job from affecting the other jobs
Problem: sort() with "n", "N" or "f" converts an item to its number on
every comparison. For "n" that is a tv2string() plus strtod()
per comparison, so sorting a list of numbers turns each number
into a string and back O(n log n) times, dwarfing the sort.
Solution: Compute the numeric key of each item once, before the sort,
and compare the stored key (Samuel Schlesinger). Only the
builtin numeric compare modes are affected; uniq(), which
passes a bare list item to the compare function, and the
string and user-function paths are unchanged.
Sorting a list of 100000 numbers (min of 3, macOS arm64):
- sort(l, 'n'): 0.205s -> 0.017s
- sort(l, 'N'): 0.017s -> 0.010s
- sort(l, 'f'): 0.014s -> 0.010s
The result is identical, including that a string is still treated as 0
in "n" mode and that "N" keeps full 64-bit precision.
Add Test_sort_numeric_precomputed(): a large shuffled list sorted with
"n", mixed integers and floats, int64 values beyond the exact range of
a double for "N", and uniq() over the non-precomputed path.
closes: vim/vim#21003c8c59db9df
Co-authored-by: Samuel Schlesinger <sgschlesinger@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Problem: Reading an undo file resolves every stored sequence number
with a linear scan over all headers, making loading
quadratic in the number of undo states.
Solution: Sort uhp_table on uh_seq once and resolve each reference
with a binary search; the duplicate uh_seq check becomes a
single pass over the sorted table (Samuel Schlesinger).
At the default 'undolevels' of 1000 the quadratic cost is not
measurable; it takes 'undolevels' in the tens of thousands to matter.
Loading an undo file with 20000 states and 50 alternate branches with
:rundo goes from 1.49s to 0.11s (min of 3, macOS arm64), with the
same undotree().
Also make old_idx/new_idx/cur_idx and the loop index "i" long instead
of short/int: they index uhp_table, whose length num_head is a long
read from the file. A short index truncated above 32767 headers,
making the restored b_u_oldhead/b_u_newhead/b_u_curhead pointers
wrong in exactly the many-headers case this change is about.
Add tests: a round-trip test with alternate branches that compares
the entries of the tree and the text at every sequence number, a
corruption test with a duplicated uh_seq, and a test for reading an
undo file with zero headers, which is written when only the line for
the "U" command is saved.
closes: vim/vim#20942fccf613c8f
Co-authored-by: Samuel Schlesinger <sgschlesinger@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Problem: In diff mode with 'cursorbind' the cursor in the other window is
not updated after an undo that changes which lines correspond.
Solution: Also check whether the text changed before skipping the update
(Hirohito Higashi).
fixes: vim/vim#20982
related: vim/vim#13219
related: vim/vim#13210
closes: vim/vim#210042045a20d4b
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Problem:
`1-` does nothing from a directory buffer, because we are already in the
buffer-local CWD. It's also unintuitive that this mapping behaves
differently based on the resolved CWD.
Solution:
Have `1-` open the global CWD.
Problem: When the owner of an undo file differs from the owner of
the text file and the current user, u_read_undo() returns
without freeing the file name it allocated with
u_get_undo_file_name().
Solution: Free the file name before returning (Samuel Schlesinger).
Every other exit of the function frees it under the "theend" label;
this early return sits before the file pointer is initialized, so it
cannot use that label.
closes: vim/vim#20987d03735e8d2
Co-authored-by: Samuel Schlesinger <sgschlesinger@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Problem: When the automatic regexp engine falls back to the
backtracking engine in vim_regexec_string(), the compiled
program is freed before the replacement is compiled; when
saving the pattern fails from being out of memory the
caller's "regprog" is left pointing to freed memory and
is freed again.
Solution: Free the previous program only after compiling the
replacement succeeded, like vim_regexec_multi() already
does (Samuel Schlesinger).
closes: vim/vim#20986cab0901f12
Co-authored-by: Samuel Schlesinger <sgschlesinger@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
- Mention unary +/- use in both integer and floating-point descriptions.
- Add "0b" binary prefix tag to match existing "0o" and "0x" tags.
closes: vim/vim#209976163d99a32
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
strace supports printing a complete stack trace for each syscall using
the `-k` (`--stack-trace`) flag. Highlight the trace as a comment.
closes: vim/vim#209982e8c81ea09
Co-authored-by: Josef Schönberger <josef.schoenberger@tum.de>
Now this was a cargo cult anti-pattern to write home about.
Doing painful save-and-restore bookkeeping around a separate
`magic_overruled` decoy global is just as messy as doing painful
save-and-restore logic around `p_magic` itself. only that now you need
to wrap every access to the effective value in a function call.
This replaces this with a marvellous new Clean Code technique™:
passing in the intended behavior as a function parameter to functions
where either the option or an explicit value might be used.
Problem:
A mark moved by nvim_buf_set_extmark() during an edit is misplaced by
undo and redo. Only splices ("edits") are recorded, and replaying them
reproduces the shifts they caused, never the explicit set: the mark ends
up wherever the text pushed it.
Solution:
When an open undo block moves an existing mark, record both positions.
Undo restores the pre-set position, redo re-applies the set.
Partially reverts 18334a4a0c ; ExtmarkSavePos.row/col were unused
because nothing recorded an explicit move, but now `extmark_set()` does.
Problem:
After #40270, events are no longer emitted from the automatic background
detection. This applies not just during startup, but also if the user
manually changes the background of their terminal.
Solution:
Set the background as normal, assuming that a normal terminal will
respond within 100 ms. Change test to match expected behavior:
- BG set during startup won't trigger user autocmds since it runs before
any user config
- If the terminal takes longer than 100 ms to respond to initial OSC 11,
it does trigger the OptionSet, but it is triggered through the normal
path to ensure values like v:option_new are set #38551
- BG change after startup still triggers autocmds #41146
vim-patch:8.2.1300: Vim9: optional argument type not parsed properly
vim-patch:8.2.1341: build failures
vim-patch:8.2.1551: Vim9: error for argument type does not mention the number
vim-patch:8.2.2630: hard to see where a test gets stuck
vim-patch:8.2.4350: FEAT_GUI_ENABLED defined but never used
vim-patch:9.0.2085: Vim9: abstract can be used in interface
vim-patch:9.1.1037: Vim9: confusing error when using abstract method via super
vim-patch:9.1.1586: Vim9: can define an enum/interface in a function
vim-patch:9.1.2076: tests: MinGW test fails midway and stops
vim-patch:9.2.0922: Wayland: modeless selection not redrawn
vim-patch:a6be0d496 CI: Add Github runner for Cygwin
vim-patch:9.2.0924: tests: Test_termwinscroll() fails on FreeBSD
vim-patch:081786261 CI: Bump github/codeql-action
vim-patch:8.1.1851: crash when sound_playfile() callback plays sound
vim-patch:8.2.1527: Vim9: cannot use a function name at script level
vim-patch:8.2.1541: Vim9: cannot find function reference for s:Func
vim-patch:8.2.1581: using line() for global popup window doesn't work
vim-patch:8.2.1582: the channel log does not show typed text
vim-patch:8.2.1592: Vim9: passing "true" to char2nr() fails
vim-patch:9.1.0879: source is not consistently formatted
Vim core did not leverage it to override/customize bell/beep.
It wasn't used for custom sounds for system/user (autocmd) events.
It should be in-scope for GUI, unlike terminal, even as a plugin
by leveraging some internal option similar to `set guioptions+=!`.
No progress as of Vim 9.2 so I quit.
vim-patch.sh fails to detect n/a patches
because of ifdef FEAT_ guards and reserved Vim9script error codes.
Ignore all conditional directives for Vim's "FEAT_" guards.
https://cppreference.com/c/preprocessor/conditional
Problem: Vim9: can't use v:true for option flags.
Solution: Add tv_get_bool_chk(). (closesvim/vim#6725)
----
"tv_get_bool_or_number_chk()" without vim9 params is identical to
"tv_get_number_chk()".
"tv_get_number_chk()" and tv"_get_bool_chk()" are identical
after excluding new vim9 params.
Yes, "want_bool" param is N/A because of "in_vim9script()".
If I port it, then I will refactor these macros or "static inline"
functions within "src/nvim/eval/typval.h".
----
36967b32fd
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: DocBook syntax variable scopes of docbk_type and docbk_ver
are not clearly documented: docbk_type uses the wrong scope
(it should be buffer-local) and docbk_ver also has an
undocumented buffer-local version.
Solution: Correct the docbk_type examples and describe the docbk_ver
precedence.
closes: vim/vim#20977e0b81136c7
Co-authored-by: Bogdan Barbu <l4b.bogdan.barbu@gmail.com>
Problem: Vim9: hasmapto(), mapcheck() and maparg() do not take "true" as
argument.
Solution: Use tv_get_bool(). (closesvim/vim#6822, closesvim/vim#6824)
04d594b9c1
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Vim9: index() does not take "true" as argument.
Solution: Use tv_get_bool_chk(). (closesvim/vim#6823)
6c553f9c04
Co-authored-by: Bram Moolenaar <Bram@vim.org>