Skip to content

Remove doubled spaces when accepting deletions - #17

Merged
smoores-dev merged 2 commits into
handlewithcarecollective:mainfrom
Magic-Marker:remove-double-spaces
Aug 27, 2025
Merged

Remove doubled spaces when accepting deletions#17
smoores-dev merged 2 commits into
handlewithcarecollective:mainfrom
Magic-Marker:remove-double-spaces

Conversation

@VV-EE

@VV-EE VV-EE commented Jul 22, 2025

Copy link
Copy Markdown
Contributor

This is just a "nice to have" feature. When a word is deleted and there are spaces on both sides they get merged, and only one space remains. Makes accepting deletions a bit better.
Added test.

Comment thread src/commands.ts Outdated
Comment on lines +73 to +79
const prevChar = tr.doc.textBetween(
deletionFrom - 1,
deletionFrom,
"x",
"x",
);
const nextChar = tr.doc.textBetween(deletionTo, deletionTo + 1, "x", "x");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think these will blow up if at the very beginning or very end of the document, no? We may need to first confirm that there is a deletionFrom - 1 and deletionTo + 1.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

(Apparently -1 is fine, but doc.content.size + 1 is not!)

@smoores-dev
smoores-dev force-pushed the remove-double-spaces branch from 564cdd2 to 8c02059 Compare August 27, 2025 14:30
@smoores-dev
smoores-dev merged commit 0260c64 into handlewithcarecollective:main Aug 27, 2025
2 checks passed
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