Skip to content

Add support for overwrite-mode to replace content with actual input#137

Open
lordnik22 wants to merge 3 commits intomasterfrom
132-replace-characters-overwrite-mode
Open

Add support for overwrite-mode to replace content with actual input#137
lordnik22 wants to merge 3 commits intomasterfrom
132-replace-characters-overwrite-mode

Conversation

@lordnik22
Copy link
Copy Markdown
Collaborator

@lordnik22 lordnik22 commented Mar 30, 2026

Fixes #132
Fixes #101

The bug #84 is really hard to solve. There is a workaround needed.
When overwrite-mode is active it tries to untabify tabs by replacing
the it with spaces. So when a tab is 4 spaces and overwrite-mode
deletes one tab, then it inserts 4 spaces and moves one space forward.
The problem: we aren't deleting any tabs so this logic should not be
triggered but it's triggered by the insertion of old-text while
old-text contains nothing whitespace related. The question persists
why is untabify-logic applied? Right, it's a bug...

Add workaround by setting deactivating overwrite-mode when calling
delete-forward/backward

Consolidate overwrite-mode handling by extracting a predicate

Handle only self-insert-commands specially in overwrite-mode

End-of-line has to handled specially because we consider spaces valid
input for newlines. overwrite-mode should not replace newlines with
spaces not should it insert additional spaces.

Test:
+ Add newline and tab insertion to default case
+ Generalize test using random
@lordnik22 lordnik22 force-pushed the 132-replace-characters-overwrite-mode branch from 43c8d28 to 27c9c57 Compare March 31, 2026 13:03
@lordnik22
Copy link
Copy Markdown
Collaborator Author

Well now, much complexity added, needs more testing...

@lordnik22
Copy link
Copy Markdown
Collaborator Author

It's hard to test something with this-original-command in it.

@lordnik22
Copy link
Copy Markdown
Collaborator Author

Backspace causes error, the session does not break.

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.

When overwrite-mode is active replace characters If overwrite-mode is active, point jumps 2 chars forward/backward

1 participant