Bug 310073 - Tab and backspace don't indent to expected position
Summary: Tab and backspace don't indent to expected position
Status: RESOLVED INTENTIONAL
Alias: None
Product: kate
Classification: Applications
Component: indentation (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-14 08:08 UTC by Romek
Modified: 2015-10-08 08:53 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Romek 2012-11-14 08:08:03 UTC
The indentation in kdevelop doesn't work as I think it should.

For example code like this:

StartsHere variable=
             someVeryLongFunctionName(with long, listof parameters, which simply, doesnt fit)
<press tab here>

kdevelop indents code in new line to the same position as previous line which is on same position as "someVeryLong...". It is obviously wrong since it is not indent of the block but of the splitted line.

It should indent new line to starts from same position as "StartsHere...".

Moreover when I press backspace then kdevelop unindents by exact spaces count set in settings, even if the cursor position is not a multiplicity of that indent size. So if for example I have indent setting of size 3 and then in code I have cursor on position 5 then backspace will unindent to position 2. In my opinion it should unindents to the next valid indent multplicity which in this case is 3.

The example editor of imho more intuitive indentation handling is QtCreator where I can just focus on the code logic and forget about formatting. In Kdevelop however, I have to constantly correct the editor choices since it is not very smart in terms of indenting.

Please fix this if you agree with me.

Reproducible: Always
Comment 1 LaChenal 2013-01-06 03:14:51 UTC
I agree, though perhaps it could be said it's just the way Kate does things by default.
For me, this is not quite as annoying and useless as the behaviour of carriage return at end of text.

However all this is already achievable by tinkering with available Settings 
Configure Kate - Editor component - Editing options- Indentation tab
    / I have set  indentation 4,  keeping tabwidth 8 (?):
adjust indent of pasted code yes, 
backspace in leading blank unindents yes, 
tab key action -always increase indentation level yes, 
and increase tab level in leading blank space yes.

At the head of that panel is also a selector "Default Indentation Mode"  to adopt standard behaviour of other editors. This is normally  set to the Kate default, which is bizarrely termed "Normal".

So, it is all possible, just that the current defaults are not that clever, and it is a bit of  a pain to navigate to alter them.
I would, however, be concerned that some admins may depend of current behaviour to 
achieve automated edits.


May I illustrate what I understand.
Assuming tab is set to six spaces, the current defaulty behaviour of Kate is like this:

+at start line
      +indented once, return
+return comes here
                  +indented thrice
            +indented thrice,place cursor before "+" & backspace once 
      +indented thrice, backspace twice
+indented thrice, backspace thrice

Which is miserable, except:

      +whereas in the case of a very long line that goes on to triggers word wrap at the archaic limit
      of 80 characters, say (for those of us who remember IBM punch cards) then it comes back to
      here (as one might expect), forming a nicedly-behaved block of text.

A more useful default, achieved once settings have been adjusted, might be this:

+at start line
    +indented once, return
    +return comes here, forming a block of text#
    +until action is taken to shift left again
+start again
            +indented thrice
        +indented thrice, place cursor at start-line (before "+") & backspace once, goes back a tab
    +indented thrice, place cursor at start-line & backspace twice, goes back two tabs
+indented thrice, backspace thrice.

~~~~~~~~~~

Tab key action "increase indentation level if in leading blank space" 
(in the CofigureKate  - Editing  - Indentation panel) seems not to work for me.

I happen to be using Mint 13 KDE just now, 
 Kate is "Version 3.8.3 Using KDE Development Platform 4.8.3 (4.8.3)" 

~~~~~~~~~~~

More annoying & useless is the insert-point behaviour at end of text. I don't see an option to change this.

The default splits the last line immediately above where the cursor is positioned (cursor somewhere below current last line of text, that is). 
This is next to useless, very irritating, because one has to locate the end of the last line to get return to work sensibly.

Current default when cursor is somewhere non-specific below the last line:

"This is what Kate currently has in it's arsenal as default"
                                                                       
                                                                    ^                     {cursor somewhere below last line}

gives insert position approximately:
"This is what Kate currently has in it's ar|senal as default"

So, adding    return[something from the pasteboard]    currently gives:
"This is what Kate currently has in it's ar
[something from the pasteboard]senal as default"

Which is about as much use a blotting paper umbrella in a hurricane.

To get it to act at all usefully, to append, one has to actually locate the very end of the last line & add there.
Which can be awkward if line-wrap is not on.

Better default behaviour would be 
"This is what Kate currently has in it's arsenal as default"|
                                                                                                   ↖  {actual insert position }
                                                                 ^            {when cursor is anywhere after EOT} 

Then adding    return[something from the pasteboard]    would give:
"This is what Kate currently has in it's arsenal as default"
[something from the pasteboard]|

Much more sensible. 
Does anyone disagree?
Comment 2 Christoph Cullmann 2015-10-08 08:53:44 UTC
Dear user,

this wish list item is now closed, as it wasn't touched in the last two years and no contributor stepped up to implement it.

The Kate/KTextEditor team is very small and we can just try to keep up with fixing bugs. Therefore wishs that show no activity for two years or more will be closed from now on to keep at least a bit overview about 'current' wishs of the users.

If you want your feature to be implemented, please step up to provide some patch for it. If you think it is really needed, you can reopen your request, but keep in mind, if no new good arguments are made and no people get attracted to help out to implement it, it will expire in two years again.

We have a nice website kate-editor.org that provides all the information needed to contribute, please make use of it. For highlighting improvements our user manual shows how to write syntax definition files.

Greetings
Christoph