Skip to content

fix: preserve registers in visual paste fallback - #26

Merged
nemanjamalesija merged 1 commit into
mainfrom
fix/visual-fallback-register-preserve
Jul 18, 2026
Merged

nemanjamalesija merged 1 commit into
mainfrom
fix/visual-fallback-register-preserve

Conversation

@nemanjamalesija

Copy link
Copy Markdown
Owner

Native visual p writes the replaced selection into the unnamed register. The smart linewise path already avoided this, but the charwise and blockwise fallbacks fed the pressed key through to native paste. The fallback now pastes with P, which places text the same way and leaves registers untouched.

Closes #25

Native visual p yanks the replaced selection into the unnamed
register, so pasting over text and then pasting again inserted the
replaced text instead of the original yank. The smart linewise path
already avoided this, but the charwise and blockwise fallbacks fed
the pressed key through to native paste and clobbered the register.

Feed the fallback as P instead. In visual mode p and P place text
identically, the only difference is that P leaves registers
untouched. Every visual paste now keeps register contents.

Refs #25
@nemanjamalesija
nemanjamalesija merged commit 7b2fe35 into main Jul 18, 2026
6 checks passed
@nemanjamalesija
nemanjamalesija deleted the fix/visual-fallback-register-preserve branch July 18, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Preserve register contents when pasting in visual mode

1 participant