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

Hitting [shift] + [tab] in the code editor doesn't work in 4.0 when no text is selected #68783

Closed
robbertzzz opened this issue Nov 17, 2022 · 2 comments

Comments

@robbertzzz
Copy link

Godot version

4.0 beta 5

System information

Windows 11

Issue description

In Godot 3.x, [shift] + [tab] will remove one tab from the start of the line even when no text is selected. In Godot 4.x, text needs to be selected for this to work. Godot's 3.x behaviour is in line with most IDEs and code editors, so reporting this as a bug.

Steps to reproduce

  1. Create a script (the default script will do) and open it in the code editor.
  2. Place the cursor/caret on an indented line.
  3. Press [shift] + [tab].
  4. Observe that nothing happens when no text is selected.

Minimal reproduction project

No response

@MewPurPur
Copy link
Contributor

MewPurPur commented Nov 17, 2022

I'm looking into it. It has been around since alpha 1, probably longer.

Edit: I can't quite understand how the indent/unindent logic is supposed to be so I won't touch it, but here's the correct one in 3.x

https://github.com/godotengine/godot/blob/3.x/scene/gui/text_edit.cpp#L3225

and incorrect one in 4.beta

https://github.com/godotengine/godot/blob/master/scene/gui/code_edit.cpp#L898

To me it looks like unindent is always supposed to call unindent_lines(), not only when something is selected or you're at the beginning of a line. But maybe there are exceptions or something? Maybe @Paulb23 can help

EDIT: Nevermind, there is a PR for this already. And it does the same thing I would - just turning do_unindent() into unindent_lines()

@MewPurPur
Copy link
Contributor

#50279 This is a duplicate apparently

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