Skip to content

Fix vim macros duplicating inserted characters#8470

Open
AshtonCoates wants to merge 5 commits intomarimo-team:mainfrom
AshtonCoates:main
Open

Fix vim macros duplicating inserted characters#8470
AshtonCoates wants to merge 5 commits intomarimo-team:mainfrom
AshtonCoates:main

Conversation

@AshtonCoates
Copy link

@AshtonCoates AshtonCoates commented Feb 26, 2026

📝 Summary

Fixes issue with CodeMirror where vim macros would duplicate characters typed in insert mode.
Closes #8469

🔍 Description of Changes

I believe that the handleKey method is called once per editor instance. Thus if we have 3 cells (editors) and enter insert mode, each of the 3 editors insert each character typed.
By removing the relevant code block I was able to fix this behavior and have not observed any side-effects.
Added comment to explain logic flow for this section
I did not add a test for this issue, but all existing other tests are passing after the change.

📋 Checklist

  • I have read the contributor guidelines.
  • For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on Discord, or the community discussions (Please provide a link if applicable).
  • Tests have been added for the changes made.
  • Documentation has been updated where applicable, including docstrings for API changes.
  • Pull request title is a good summary of the changes - it will be used in the release notes.

@vercel
Copy link

vercel bot commented Feb 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment Mar 2, 2026 11:42pm

Request Review

@github-actions
Copy link

github-actions bot commented Feb 26, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@AshtonCoates
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

@Light2Dark Light2Dark added the bug Something isn't working label Feb 26, 2026
@AshtonCoates
Copy link
Author

recheck

Copy link
Collaborator

@manzt manzt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for putting this up. I can see that our handleKey approach breaks macros.

However, I believe removing this block disables insert-mode syncing across cells, which we don't want to regress. We likely need a more direct way to enter insert mode on sibling editors (similar to how the "normal" case calls Vim.exitInsertMode directly).

@AshtonCoates
Copy link
Author

Thanks for the feedback, I hadn’t considered the syncing issue. I’m still getting familiar with the codebase and frontend framework, so I appreciate the clarification.

I’ll take another look and work on a more robust approach

@AshtonCoates
Copy link
Author

Just realized last commit included a regression, I'll fix soon

@AshtonCoates
Copy link
Author

@manzt I implemented a workaround by essentially skipping the mode change broadcast when we're recording or playing a macro. This shouldn't break synchronization because a macro should take place within one cell anyways, and should always start and end in normal mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Characters copied in Vim macros

3 participants