Bug 359840

Summary: Incorrect smartTab indentation mode implementation
Product: [Applications] kate Reporter: lampus.lapin
Component: partAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED NOT A BUG    
Severity: normal CC: ekigwana
Priority: NOR Keywords: usability
Version First Reported In: 5.0.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description lampus.lapin 2016-02-26 21:41:58 UTC
It's not a bug actually, but very strange behavior for advanced text editor.
Accordingly to source code radio button "Increase indentations level if in leading blank space" enables so called "Smart Tab Mode":
KateDocumentConfig::global()->setTabHandling(KateDocumentConfig::tabSmart);

But it works in absolutely opposite way than expected.
When we say about "Smart Tabs" usually is mentioned something like described here: https://www.emacswiki.org/emacs/SmartTabs

Short quote from link above: "There is a semantic way of using tab characters in source code: tabs for indentation, spaces for alignment. This ensures that the code is displayed correctly everywhere, regardless of the viewer’s tab size."

Reproducible: Always

Steps to Reproduce:
1. Start any application based on ktexteditor component (e.g. kate)
2. Go to Indentation Config dialog (Kate-specific example: Settings -> Configure Kate... -> Editing -> Indentation)
3. Select Default indentation mode: Normal
Check radio button "Tabulators and spaces" in "Indent using:" group box.
Check radio button "Increase indentations level if in leading blank space"
4. Press "Tab"
5. Input some keyword
6. Press "Tab" again

Actual Results:  
String "....keyword\t", where
'.' - space symbol,
\t - tabulator;


Expected Results:  
String "\tkeyword...."

ktexteditor version 5.19.0
Comment 1 Edward Kigwana 2019-05-25 08:10:23 UTC
The reporter prefers first indention to be a tab and subsequent tabs to be replaced with equivalent number of spaces.

The "Indent using" option is clear for (1) Tabulators, (2) Spaces, (3) Tabulators and spaces.

The value of a fourth option (4) Tabulator and spaces is debatable since you might as well just indent with (2) spaces.