Skip to content

Fix deleteWordRight behavior with multiple whitespace#306105

Open
robot-mazeee wants to merge 1 commit intomicrosoft:mainfrom
robot-mazeee:fix-deletewordright-whitespace
Open

Fix deleteWordRight behavior with multiple whitespace#306105
robot-mazeee wants to merge 1 commit intomicrosoft:mainfrom
robot-mazeee:fix-deletewordright-whitespace

Conversation

@robot-mazeee
Copy link
Copy Markdown

Previously, deleteWordRight behaved inconsistently when multiple whitespace characters appeared before the next word. In such cases, only the whitespace was removed, while a single whitespace correctly removed both the whitespace and the following word.

Fix: Update the whitespace heuristic to treat consecutive whitespace as a single region and continue deletion through the next word when using WordEnd navigation.

Behavior is now consistent across cases:

  • Multiple spaces before a word are removed together with the word
  • Punctuation is not consumed (e.g. numbers with decimals)
  • Word boundaries such as underscore-separated identifiers are handled correctly

This preserves existing behavior for non-word tokens while fixing the whitespace edge case.

Fixes #259145

Previously, deleteWordRight behaved inconsistently when multiple
whitespace characters appeared before the next word. In such cases,
only the whitespace was removed, while a single whitespace correctly
removed both the whitespace and the following word.

Fix: Update the whitespace heuristic to treat consecutive whitespace
as a single region and continue deletion through the next word when
using WordEnd navigation.

Behavior is now consistent across cases:
- Multiple spaces before a word are removed together with the word
- Punctuation is not consumed (e.g. numbers with decimals)
- Word boundaries such as underscore-separated identifiers are
  handled correctly

This preserves existing behavior for non-word tokens while fixing
the whitespace edge case.

Fixes microsoft#259145
@robot-mazeee
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree company="Instituto Superior Técnico"

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.

deleteWordRight handles 1 whitespace differently from 2 whitespace

2 participants