Pressing tab to indent after non-leading-whitespace characters in a line causes incorrect alignment, at least when using soft tabs. Reproducible: Always Steps to Reproduce: 1. Select "Spaces" indentation mode. For reference, I'm also using Indentation=4, Tab Width=8, but the behavior is seen even when both are set to the same value. 2. Type some lines you expect to be aligned: (special keystrokes in {}) {\t}int{\t}{\t}x;{\n}{\t}string{\t}y;{\n}{\t}bool{\t}z;{\n} Actual Results: (Tab Width) spaces are inserted at the current position: int x; string y; bool z; Expected Results: (Indentation Width) - (Cursor Position) % (Indentation Width) spaces should be inserted: int x; string y; bool z; Using KTextEditor 5.3.0, built from source; also appears with KTextEditor from git master. KWrite 4.14.1 behaves better in that the second column is at least aligned, but still not correct (IMO), in that it aligns to 8 spaces after the initial leading whitespace, even if 4 is configured for the Indentation Width.
Git commit 204fed7b8f5aaaa8b8d4516664b8720f6c2b8315 by Christoph Cullmann. Committed on 18/11/2014 at 18:54. Pushed by cullmann into branch 'master'. Fix bug #340212: incorrect soft-tabs alignment after beginning-of-line Fix for incorrect soft-tabs alignment after beginning-of-line, by taking the current cursor position into account when expanding tabs to spaces. This also now uses the indentation width rather than the tab width, as I see "Tab Width" as being the actual width of the \t character, and "Indentation width" as being the next alignment position for virtual indentation. This more closely matches other editors (e.g. vim) which have similar indentation control. Patch by Michael Hansen REVIEW: 120760 M +23 -7 src/document/katedocument.cpp M +6 -1 src/document/katedocument.h http://commits.kde.org/ktexteditor/204fed7b8f5aaaa8b8d4516664b8720f6c2b8315