Automatic indentation misaligned after closing brace
Affected version
- Nightly flatpak: Yes
- Other: Void Linux x86_64 glibc 2.39, gnome-builder 45 (also happened with 44)
Steps to reproduce
- Create new project (with auto-indentation enabled)
- Add a new .c file
- Paste the following code:
int main() {
{
}
return 0;
}
- Attempt to add a newline after the closing brace inside the main function.
- With spaces enabled, gnome-builder will indent 13 spaces. (the number of characters in
int main() {
plus 1) With tabs enabled it will mix tabs and spaces to match the same indentation. (Note: this issue occurs whether spaces or tabs are used, after a for loop, it will try to align 1 space after the last brace, which is not the case elsewhere)
Current behavior
With automatic indentation enabled, pressing return after a closing brace will cause gnome-builder to align to the current scope's opening brace +1. (this issue can also be noticed when using braces inside of braces)
Expected behavior
With automatic indentation enabled, pressing return after a closing brace will cause gnome-builder to align to the correct number of spaces/tabs as any other statement/expression.
Additional information
Unlike #1227 (which I cannot reproduce), the misaligned indentation does not occur for me after the opening brace, just the closing brace.
Edited by A G