Skip to content

indentation fixes

Ilia Kats requested to merge work/iliakats/juliaindent into kf5

This addresses utilities/kate#97 (closed). First, the Julia indentation script is fixed to work correctly both when "keep extra spaces" is enabled and when re-indenting an entire block of code. Second, the behavior of the "keep extra spaces" option is changed as outlined in that issue: Within keepIndent, which is called when an indentation script returns -1, only the extra spaces from the current line that are not a multiple of the indentation width are added to the indentation of the previous line. Moreover, the "keep extra spaces" option is temporarily disabled when re-indenting an entire code block.

I've done some limited testing locally. In particular, pasting a block of C++ code with the "keep extra spaces" option enabled now indents the code correctly. Also, all the unit tests pass. Note that I currently don't have a kf6 development environment set up, so this MR targets kf5. There are zero differences between the master and kf5 versions of src/utils/kateautoindent.cpp, so I assume that this will also work as expected in master and would be happy to cherry-pick or merge into master.

Merge request reports