Bug 153324

Summary: [PATCH] Make keepIndent in the KatePart autoindenter really keep the existing indentation
Product: [Applications] kate Reporter: Kevin Kofler <kevin.kofler>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: wishlist CC: cullmann, shentey
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Make keepIndent behave as advertised

Description Kevin Kofler 2007-12-03 07:55:16 UTC
Version:           KDE 3.96.2 (using KDE KDE 3.96.0)
Installed from:    Fedora RPMs

While this is technically not a bug, the KatePart autoindenter has that annoying behavior of keeping only the indentation count and not the actual indentation characters from an original source file. This means that when working on sources with different conventions, the indentation settings have to be changed for every single source file to match its conventions or it will screw up the existing indentation as soon as a line is added. (Unfortunately, we can't really expect all source code in the world to have Kate modelines. ;-) )

The simple patch I'm about to attach (not tested yet though) changes the keepIndent function so it actually keeps the existing indentation of the preceding line verbatim. The intent here is that if the original was indented with 2 tabs and 3 spaces, it will always reproduce 2 tabs and 3 spaces, no matter what the indentation settings are. Even weird sequences like tab space space tab space should be reproduced as is.

Comments welcome on:
* whether this is a good idea or not,
* whether the patch will actually work with all possible settings or some settings like "indent with spaces" will cause the tabs to get replaced anyway,
* whether this can be included in 4.0.

(Note that this is related to, but not the same as, bug 145664.)
Comment 1 Kevin Kofler 2007-12-03 07:56:22 UTC
Created attachment 22296 [details]
Make keepIndent behave as advertised

And here's the promised patch.
Comment 2 Kevin Kofler 2008-08-20 09:52:29 UTC
Any objections to me committing this patch?
Comment 3 Kevin Kofler 2010-02-18 03:52:36 UTC
Looks like this has finally been fixed now, with a new bug report and a different patch. No idea why my patch got ignored, but at least the issue is fixed now.

*** This bug has been marked as a duplicate of bug 214147 ***
Comment 4 Bernhard Beschow 2010-02-18 12:35:56 UTC
> No idea why my patch got ignored, but at least the issue is fixed now.

... because I wasn't aware of your bug report. Since you already prepared a patch, you should have bugged the Kate devs more back then ;-) They're usually very open for patches. Thank you anyway for this bug report and even providing a patch.
Comment 5 Christoph Cullmann 2010-02-18 12:47:34 UTC
Btw., really thanks for using kate and even providing a patch :( I am sorry I never got time to really look at it nor apply it :(