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

CodeEdit: Auto Indent behaves differently than Convert Indent to Tabs or Spaces. #78680

Open
capnm opened this issue Jun 25, 2023 · 2 comments
Open

Comments

@capnm
Copy link
Contributor

capnm commented Jun 25, 2023

Godot version

3.x, 4.x

Issue description

IMO Auto Indent should call Convert Indent to Tabs or Convert Indent to Spaces, dependent on the default editor settings for tabs or spaces.
And / or properly adjust the indentation in the current cursor line (or line selection), if this was implemented for this purpose (I couldn't follow the implementation myself).

Steps to reproduce

For example, with the default editor settings, indent some line with 4 spaces. Auto Indent [Ctrl-i] inserts 2 TABs, Convert Indent to Tabs inserts 1 TAB.

Minimal reproduction project

See also fix indentation in script templates.

image

@AThousandShips
Copy link
Member

AThousandShips commented Jun 25, 2023

Will have to dig into the code tomorrow but what it should do is call CodeEdit::convert_indent IMO, that's what's done on save, but will have to see

Edit: Auto indent does more than this so will need more investigation, will see

@AThousandShips
Copy link
Member

Note that Auto Indent is not the same as those two other functions, it corrects indentation and should do things like:

if foo:
        bar()

to:

if foo:
    bar()

So this is much more complex and also only affects selection I believe

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

2 participants