diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2026-09-19 14:38:11 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-19 14:38:11 -0400 |
| commit | dcf55c0cecb3049745cbe5c9ec3e5c9146cd8464 (patch) | |
| tree | 3ee1ff1b19f423298bbd7cda5229f3be6eeb9955 /runtime/syntax/cpp.vim | |
| parent | 03c74c34bd0aa6f08234776d338bb92b37e4137a (diff) | |
| download | rneovim-dcf55c0cecb3049745cbe5c9ec3e5c9146cd8464.tar.gz rneovim-dcf55c0cecb3049745cbe5c9ec3e5c9146cd8464.tar.bz2 rneovim-dcf55c0cecb3049745cbe5c9ec3e5c9146cd8464.zip | |
fix(multicursor): selection by API/Lua from mapping #41999
Problem:
A Visual selection produced by a Lua mapping is captured as the keys it
fed (`:norm!`), so non-primary cursors get the wrong selection.
Examples:
- API cursor-moves around a fed "o" are lost.
- `setpos("'<")` + "gv" reselects the primary's marks (treesitter `an`).
- A mapping that feeds an absolute selection (`:norm! <Esc>`, then
`norm! 3GV6G`).
Solution:
Classify fed keys as `lossy` if their produced selection differs from
the selection at mapping-end, or fed-key-start: the mapping moved it by
other means (API). Same idea as `composite.lossy` LHS-replay.
Now the captured Visual session contains the mapping's own cmd
(`<Cmd>…`, `:…`, or a Lua mapping-id) as one subatom, instead of the
keys it fed. E.g. `v…<K_LUA id>` instead of `v…V…G`.
Also affects dot-repeat (".").
A `:norm!` that ends a typed selection keeps the Visual session
(`vatom`) open (instead of the usual `atom_visual_reset()` plus
emit/stage), so the enclosing user frame (the mapping's `<Cmd>`/Lua, or
a typed `:norm!`) can complete or replace it.
- A child frame re-entering Visual does not restart it, so a later
`norm! V` continues that session instead of a new `kVatomFed` one.
- At end of the user (toplevel) frame, the fed subatoms are dropped in
favor of the mapping's own atom: as a subatom if Visual is active,
else as the session's closing suffix.
Diffstat (limited to 'runtime/syntax/cpp.vim')
0 files changed, 0 insertions, 0 deletions