Skip to content

Fix normal-mode paste to insert at cursor - #1

Draft
hashkrish wants to merge 1 commit into
mainfrom
cursor/paste-at-cursor-e2bd
Draft

Fix normal-mode paste to insert at cursor#1
hashkrish wants to merge 1 commit into
mainfrom
cursor/paste-at-cursor-e2bd

Conversation

@hashkrish

Copy link
Copy Markdown
Owner

Summary

In normal mode, p and bracketed paste now insert at the cursor position instead of after the character under the cursor.

edtui's default Paste action uses append_str, which advances one column before inserting. This wrapper intercepts p in normal mode and routes paste through insert-mode positioning so text lands where the block cursor sits.

Changes

  • Intercept p in EditorBuffer::handle_key when in normal mode
  • Route bracketed paste through the same at-cursor path in normal mode
  • Add unit tests for both p and bracketed paste

Test plan

  • cargo fmt
  • cargo clippy --all-targets (zero warnings)
  • cargo test (all green)
Open in Web Open in Cursor 

edtui's default p uses append_str, which skips past the character under
the cursor before inserting. Intercept p and bracketed paste in normal
mode so text lands at the cursor position instead.

Co-authored-by: Santhana Krishnan S <hashkrish@users.noreply.github.com>
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.

2 participants