| Summary: | indent re-aligns (incorrectly) indented "if blocks" in C code | ||
|---|---|---|---|
| Product: | [Applications] kate | Reporter: | cat22 <erbenton> |
| Component: | application | Assignee: | KWrite Developers <kwrite-bugs-null> |
| Status: | RESOLVED NOT A BUG | ||
| Severity: | normal | CC: | a.samirh78 |
| Priority: | NOR | ||
| Version First Reported In: | 19.04.1 | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
| Attachments: | editing options settings | ||
The first block of code you posted, the indentation of the code inside the if loop is using only 3 spaces, if you set the "indentation width" to 4 spaces, then that's what's confusing ktexteditor here, IIUC. Created attachment 120964 [details]
editing options settings
Comment on attachment 120964 [details]
editing options settings
The examples i posted might have had there spacing off. I checked in kates settings and indentation is set to 4 spaces:
See attached screen shot
If you correct the spacing/indenting of the code inside the if loop, does kate work as you expect? Yes, it appears to work if i do that. If you agree this isn't a bug please close the report; thanks. |
SUMMARY If I highlight the entire block (select by lines, e.g set cursor in column 1 (press home key twice) and press shift down arrow until all the lines are selected) and press Ctrl+i the block is moved to the right but the already indented code becomes column aligned. e.g: if(open_database(&mysql)) { log_error("ERROR!!! Failed to open database\n"); debug_print("LEAVE\n"); return -1; } becomes if(open_database(&mysql)) { log_error("ERROR!!! Failed to open database\n"); debug_print("LEAVE\n"); return -1; } I played with the settings for indentation but couldn't fix it STEPS TO REPRODUCE 1. 2. 3. OBSERVED RESULT if(open_database(&mysql)) { log_error("ERROR!!! Failed to open database\n"); debug_print("LEAVE\n"); return -1; } EXPECTED RESULT if(open_database(&mysql)) { log_error("ERROR!!! Failed to open database\n"); debug_print("LEAVE\n"); return -1; } SOFTWARE/OS VERSIONS Linux/KDE Plasma: (available in About System) KDE Plasma Version: No longer reported in 'About KDE' in Kate! Why is that?!?! Determined from other sourcesits KDE 5.58.0 Plasma 5.16.05.12.3 KDE Frameworks Version: Qt Version: Unknown, how does one get this info? I think its 5.12.3 ADDITIONAL INFORMATION Opensuse Tumbleweed x86_64