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

Implement pressing Escape to clear text selection in LineEdit and TextEdit #4766

Closed
ZachIsAGardner opened this issue Jun 27, 2022 · 3 comments

Comments

@ZachIsAGardner
Copy link

Describe the project you are working on

Just messing around in Godot 3.X and 4.0 alpha.

Describe the problem or limitation you are having in your project

I'm used to being able to press Escape to clear my current selection in a code editor.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Having a configurable shortcut for clearing the current selection would be helpful.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

This is something that could be added as it's own shortcut in the Script Text Editor category. Or it could be hooked into the existing ui_cancel shortcut. This would be similar to Evaluate Selection, it just wouldn't move the cursor around.

If this enhancement will not be used often, can it be worked around with a few lines of script?

I'm not sure.

Is there a reason why this should be core and not an add-on in the asset library?

I think most people would appreciate this.

@Calinou Calinou changed the title Escape (Configurable Shortcut) Should clear current selection in script editor Implement pressing Escape to clear text selection in LineEdit and TextEdit Jun 28, 2022
@Calinou
Copy link
Member

Calinou commented Jun 28, 2022

This needs to be implemented in LineEdit and TextEdit in general, so that non-game applications using Godot can have this behavior out of the box. We may need to add a property to disable this behavior on a per-node basis, as it's sometimes undesired. For instance, Visual Studio Code supports pressing Escape to unselect all text, and so do web browsers in <input> and <textarea> fields. However, Firefox's address bar does not deselect text when pressing Escape.

The script editor (which uses CodeEdit under the hood) will automatically benefit from this as a result.

@kitbdev
Copy link

kitbdev commented Mar 14, 2024

@Calinou
Copy link
Member

Calinou commented Mar 15, 2024

Closing, as this proposal is implemented since 4.2 as per the above comment. I've tested it in the script editor and it works too.

@Calinou Calinou closed this as completed Mar 15, 2024
@Calinou Calinou added this to the 4.2 milestone Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants