Skip to content

Conversation

@adityavc
Copy link
Contributor

@adityavc adityavc commented Apr 22, 2024

Trim Whitespace on Newline Character Deletion: #134898

Description: The main changes were made to the getDeleteRange function -- when deleting a new line character, the range will be the last non whitespace character in the first line to the first non whitespace character in the second line.

However, there are some exceptions, if the line with the new line character does not have text (only contains spaces/tabs) then left white space is not trimmed. Additionally if the line with new line character is empty then the right white space is not trimmed. This is to preserve any indented code while deleting.

Example:
Screen Shot 2024-04-22 at 12 42 40 AM
deleting the new line character will result in
Screen Shot 2024-04-22 at 12 43 39 AM

Testing: a unit test was created in cursor.test to verify functionality.

I found this issue when going through the backlog -- unsure if it's still desired functionality.

Fixes #134898

@adityavc
Copy link
Contributor Author

@microsoft-github-policy-service agree

@DonJayamanne
Copy link
Contributor

@adityavc I'm very sorry for missing this PR, will look into this.

alexdima
alexdima previously approved these changes Jul 15, 2025
Copy link
Member

@alexdima alexdima left a comment

Choose a reason for hiding this comment

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

Thank you and apologies for the slow turn-around time!

@alexdima alexdima enabled auto-merge July 15, 2025 20:54
@vs-code-engineering vs-code-engineering bot added this to the July 2025 milestone Jul 15, 2025
DonJayamanne
DonJayamanne previously approved these changes Jul 15, 2025
@alexdima alexdima dismissed stale reviews from DonJayamanne and themself via a11e611 July 15, 2025 22:06
@alexdima alexdima merged commit 9bb90bd into microsoft:main Jul 15, 2025
17 checks passed
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Aug 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trim whitespace when deleting newline

5 participants