Skip to content

Fix word deletion behavior with multiple spaces#604

Open
Rigidity wants to merge 1 commit intolinebender:mainfrom
Rigidity:fix-word-delete-spaces
Open

Fix word deletion behavior with multiple spaces#604
Rigidity wants to merge 1 commit intolinebender:mainfrom
Rigidity:fix-word-delete-spaces

Conversation

@Rigidity
Copy link
Copy Markdown

When using the delete word methods, if there are multiple spaces they are treated as a standalone word. Thus, when backdeleting with the cursor at the end of word , it deletes the whole thing, but with word , it only deletes the four spaces.

I'm not sure of other implications, but I tested this fix locally and it seems to work fine with both single space gaps and multi space gaps, for forward and backward word deletion. It matches the native behavior of MacOS.

@nicoburns
Copy link
Copy Markdown
Collaborator

Hmm... not sure about changing from logical to visual here. That's going to change the order in which words are deleted for RTL text.

@Rigidity
Copy link
Copy Markdown
Author

It looks like next_visual_word and previous_visual_word handle whitespace explicitly. So perhaps this logic can just be ported over to the two logical word methods

@nicoburns
Copy link
Copy Markdown
Collaborator

That seems plausible to me, but I'm not confident in that.

@xStrom
Copy link
Copy Markdown
Member

xStrom commented Apr 17, 2026

I can confirm that the desired behavior on Windows is also to delete the word and the multiple spaces in one go. I think that fixing next_logical_word to ignore repeated whitespace is the way to go.

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.

3 participants