Bug 474505 - Kate auto-detects unsuitable indentation
Summary: Kate auto-detects unsuitable indentation
Status: REPORTED
Alias: None
Product: kate
Classification: Applications
Component: indentation (show other bugs)
Version: 23.08.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-13 20:59 UTC by Ingo Klöcker
Modified: 2024-03-23 22:08 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Markdown file for which Kate auto-detects indentation width 7 (14.05 KB, text/markdown)
2023-09-13 20:59 UTC, Ingo Klöcker
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ingo Klöcker 2023-09-13 20:59:42 UTC
Created attachment 161612 [details]
Markdown file for which Kate auto-detects indentation width 7

For the attached file Kate auto-detects an indentation of 7. I think it shouldn't assume any indentation width for this file and instead use the default.

STEPS TO REPRODUCE
1. Enable "Automatically detect file indentation"
2. Open the attached file

OBSERVED RESULT
Kate automatically sets indentation to 7. Shows "Soft Tabs: 7 (4)" in the status bar.

EXPECTED RESULT
Kate uses standard indentation, i.e. 4.

Even though the file ends with many lines which seem to suggest an indentation of 7, there are many other lines which suggest indentations of 4, 12, 32. I think, in case of an indentation histogram with multiple peaks without a common divisor, Kate shouldn't assume a non-standard indentation. Or it should switch from fixed width indentation to "smart indentation" (i.e. indentation based on the next non-empty line above the cursor).
Comment 1 Waqar Ahmed 2023-09-14 06:19:21 UTC
I think it's best that we switch off auto-detect for md files as it's rather arbitrary what it can contain and detecting indent make a lot of sense in md files.
Comment 2 Christoph Cullmann 2024-03-23 22:08:10 UTC
Hmm, the question is if we ever should detect indents that are not even a multiple of 2.