Problem:
Directory listing entries cannot be customized (filtered, reordered).
Listings are read by a BufReadCmd, which suppresses BufReadPost, so they
are the only buffers with no post-read event to hook.
Solution:
Introduce a post-render User autocmd `DirReadPost`, marking the dir
buffer writable for the duration and before the cursor is placed, so
handlers can sort or filter it with ordinary commands. Document common
recipes
Problem:
There is no unified notion of a "user action".
Vim processes input by one-char-at-a-time, and mostly throws away any
hints it might gather about the user's action, with one exception: it
stores the last _edit_ action (the "redo buffer", encoded as
unstructured `["x][v][count]body` bytes).
Plugins can only observe individual keys (vim.on_key) and high-level
effects (TextChanged, CursorMoved).
Solution:
- Users can subscribe to `CmdAtom` events to handle any user action.
- Event is deferred; handlers cannot cancel or interfere with user
actions.
- Capture `CmdSpec` from the normal/insert/visual subsystems.
- typeahead/readahead stay unstructured (`buffheader_T`): they are key
streams, not commands.
- the redo/record buffers become `StringBuilder`: fewer
allocations/copies.
- Repurpose the input/redo engine to accept `CmdSpec` objects.
"atom": one repeatable unit of user input, as a resolved (post-mapping)
keysequence plus structured fields. Only user actions, not `:normal`,
API calls, or non-"t" `feedkeys`.
BREAKING: dot-repeat of an Insert session, replays the entire session
including cursor-moves (:help ins-repeat).
BREAKING: dot-repeat of a Visual operation, replays the selection
instead of operating on a fixed-size region.
vim-patch:9.2.0946: GTK2/3: mouse move starts Visual selection after a dialog
vim-patch:9.2.0947: GTK4: screen is cleared when moving the mouse after startup
vim-patch:9.2.0948: GTK4: mouse move starts Visual selection after a dialog
vim-patch:9.2.0949: GDK_KEY_VoidSymbol might be undefined
vim-patch:9.2.0951: GTK3: cursor does no longer blink
vim-patch:9.2.0955: tests: terminal tests are flaky
vim-patch:9.2.0956: GTK4: crash when the window is resized while redrawing
vim-patch:8.1.0768: updating completions may cause the popup menu to flicker
vim-patch:8.1.0863: cannot see what signal caused a job to end
vim-patch:8.1.0876: completion match not displayed when popup menu is not shown
vim-patch:8.1.0894: MS-Windows: resolve() does not return a reparse point
vim-patch:8.1.1218: cannot set a directory for a tab page
vim-patch:8.1.1224: MS-Windows: cannot specify font weight
vim-patch:8.1.1417: MS-Windows: resolve() does not resolve all components of path
vim-patch:8.1.1473: new resolve() implementation causes problem for plugins
vim-patch:8.1.1525: cannot move a popup window with the mouse
vim-patch:8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
vim-patch:8.1.1561: popup_setoptions() is not implemented yet
vim-patch:8.1.1577: command line redrawn for +arabic without Arabic characters
vim-patch:8.1.1580: cannot make part of a popup transparent
vim-patch:8.1.1589: popup window does not indicate scroll position
vim-patch:8.1.1597: cannot scroll a popup window with the mouse
vim-patch:8.1.1609: the user cannot easily close a popup window
vim-patch:8.1.1612: cannot show an existing buffer in a popup window
vim-patch:8.1.1626: no test for closing a popup window with a modified buffer
vim-patch:8.1.1628: popup window functions not in list of functions
vim-patch:8.1.1713: highlighting cursor line only works with popup_menu()
vim-patch:8.1.1714: cannot preview a file in a popup window
vim-patch:8.1.1718: popup menu highlighting does not look good
vim-patch:8.1.1770: cannot get the window ID of the popup preview window
vim-patch:8.1.1784: MS-Windows: resolve() does not work if serial nr duplicated
vim-patch:8.1.1787: cannot resize a popup window
vim-patch:8.1.1799: cannot avoid mapping for a popup window
vim-patch:8.1.1813: ATTENTION prompt for a preview popup window
vim-patch:8.1.1819: :pedit does not work with a popup preview window
vim-patch:8.1.1880: cannot show extra info for completion in a popup window
vim-patch:8.1.1882: cannot specify properties of the info popup window
vim-patch:8.1.1884: cannot use mouse scroll wheel in popup in Insert mode
vim-patch:8.1.1892: missing index entry and option menu for 'completepopup'
vim-patch:8.1.1904: cannot have an info popup align with the popup menu
vim-patch:8.1.1905: cannot set all properties of the info popup
vim-patch:8.1.1906: info popup size is sometimes incorrect
vim-patch:8.1.1908: every popup window consumes a buffer number
vim-patch:8.1.1928: popup windows don't move with the text when making changes
vim-patch:8.1.1969: popup window filter is used in all modes
vim-patch:8.1.2039: character from 'showbreak' does not use 'wincolor'
vim-patch:8.1.2092: MS-Windows: redirect in system() does not work
vim-patch:8.1.2093: MS-Windows: system() test fails
vim-patch:8.1.2139: the modifyOtherKeys codes are not tested
vim-patch:8.1.2142: some key mappings do not work with modifyOtherKeys
vim-patch:8.1.2153: combining text property and syntax highlight is wrong
vim-patch:8.1.2155: in a terminal window 'cursorlineopt' does not work properly
vim-patch:8.1.2158: terminal attributes missing in Terminal-normal mode
vim-patch:8.1.2192: cannot easily fill the info popup asynchronously
vim-patch:8.1.2208: Unix: Tabs in output might be expanded to spaces
vim-patch:8.1.2273: wrong default when "pos" is changed with popup_atcursor()
vim-patch:8.1.2279: computation of highlight attributes is too complicated
vim-patch:8.1.2324: with of scrollbar in popup menu not taken into account
vim-patch:8.1.2351: 'wincolor' not used for > for not fitting double width char
vim-patch:8.1.2362: cannot place signs in a popup window
vim-patch:8.1.2386: 'wincolor' is not used for 'listchars'
vim-patch:8.1.2399: info popup on top of cursor if it doesn't fit
vim-patch:8.1.2415: popup menu flickers if an info popup is used
vim-patch:8.1.2418: bufnr('$') is wrong after recycling popup buffer
As a refinement upon "g:sh_no_error", support not matching
particular classes of syntax errors. Look up syntax rule
names and list them with:
‐-----------------------------------------------------------
let g:sh_no_error_rules = ["shCurlyError", "shParenError"]
‐-----------------------------------------------------------
closes: vim/vim#209355d41506eb4
Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
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>