Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore empty lines when uncommenting code #81486

Conversation

jsjtxietian
Copy link
Contributor

Fixes #81474

@jsjtxietian jsjtxietian requested a review from a team as a code owner September 9, 2023 13:11
@jsjtxietian jsjtxietian changed the title Ignore empty lines when uncommenting code. Ignore empty lines when uncommenting code Sep 9, 2023
@AThousandShips AThousandShips added this to the 4.x milestone Sep 9, 2023
editor/code_editor.cpp Outdated Show resolved Hide resolved
@jsjtxietian
Copy link
Contributor Author

I did some test with vscode and have updated my code a little bit according to vscode's default behaviour, the code works this way now:

When commenting/uncommenting code, empty lines do not affect godot's decision of whether the selected code is commented or not, unless they are all empty lines, in that case I treat them as uncommented code.

@jsjtxietian jsjtxietian force-pushed the Ignoring-empty-lines--when-uncommenting branch from b88a2fb to 488df1b Compare September 11, 2023 08:18
editor/code_editor.cpp Outdated Show resolved Hide resolved
editor/code_editor.cpp Outdated Show resolved Hide resolved
@jsjtxietian
Copy link
Contributor Author

jsjtxietian commented Sep 19, 2023

Hi @Paulb23
If I get your example right, the origin example should look like this, one caret with a selection on lines 1-3, the second caret is on line 3:

image

After I commented in the current stable 4.1, it became this, looks like both carets collapsed:

image

And in the godot with my commit, it became this:

image

The caret's position changed, yes, but the master version doest't seem working correctly too.

@jsjtxietian jsjtxietian force-pushed the Ignoring-empty-lines--when-uncommenting branch from 488df1b to 57fef5c Compare September 19, 2023 08:05
@jsjtxietian jsjtxietian force-pushed the Ignoring-empty-lines--when-uncommenting branch from 57fef5c to 12299e0 Compare September 20, 2023 10:56
@akien-mga akien-mga merged commit 3c63b09 into godotengine:master Sep 26, 2023
16 checks passed
@akien-mga
Copy link
Member

Thanks!

@akien-mga akien-mga modified the milestones: 4.x, 4.2 Sep 26, 2023
@jsjtxietian jsjtxietian deleted the Ignoring-empty-lines--when-uncommenting branch October 18, 2023 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Empty lines should be ignored when comment/uncomment code
5 participants