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).
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.
Hmm, the question is if we ever should detect indents that are not even a multiple of 2.
Git commit 0662c13838970f25e57c6af986b561619b840427 by Christoph Cullmann. Committed on 18/06/2024 at 18:56. Pushed by cullmann into branch 'master'. prefer even indent sizes only guess non-even ones if there are no even matches A +402 -0 autotests/input/indent_detect/bogus7spaces.md M +1 -0 autotests/src/indentdetect_test.cpp M +5 -5 src/utils/kateindentdetecter.cpp https://invent.kde.org/frameworks/ktexteditor/-/commit/0662c13838970f25e57c6af986b561619b840427