kate ignores settings for TAB

Bug #282234 reported by wateenellende
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
KDE Software Development Kit
Fix Released
Medium
One Hundred Papercuts
Invalid
Undecided
Unassigned
Fedora
Invalid
Low
kdesdk (Ubuntu)
Triaged
Low
Unassigned

Bug Description

Binary package hint: kate

When I press TAB, I want to have a tabulator (no spaces), and have it 8 chars wide. This is in my config under "Editing", and in previous versions was respected. The current version in Intrepid (see below for details) ignores these settings, even though they are really set correctly, and produces 2 spaces.

This is extremely annoying when typing source code, I now have to copy-paste tabs from existing documents.

$ dpkg -s kate
Package: kate
Status: install ok installed
Priority: optional
Section: editors
Installed-Size: 2652
Maintainer: Kubuntu Developers <email address hidden>
Architecture: amd64
Source: kdesdk
Version: 4:4.1.2-0ubuntu1
Replaces: kate-kde4

Revision history for this message
In , Kevin-kofler (kevin-kofler) wrote :

Version: KDE 3.90.1 (using KDE Devel)
Installed from: Compiled sources
Compiler: g++ 4.1.1-51.fc6
OS: Linux

I normally indent with spaces, so I want to have the indentation mode set to spaces, however when I press the TAB key, I really really want a tab, not a bunch of spaces, I'd have pressed the space key if I wanted that! ;-)

I don't think I'm the only one who wants that, thus this RFE.

Note that I can get the KDE 3.5 KatePart to mostly do what I want by disabling "use spaces instead of tabs" under Editing and enabling it under Indentation (and also disabling the "Emacs-style" option, which isn't there in KDE 3.90.1 anymore either), but the fact that this works is probably more accidental than intentional. :-)

Speaking of that "Emacs-style" option which can't be disabled anymore, I think that's a horrible way to do indentation. For example, the following code:
[TAB]if (foo
[TAB]____&& bar)
will only align correctly independently of the tabstop setting (which is something the user should be able to set, otherwise what's the point of using tabs at all?) if tabs are used where I used [TAB] and spaces where I used _. The "Emacs-style" indentation breaks that (try it with 4-space tabs and it will change the spaces to a tab, then try switching to 8-space tabs and look at the resulting mess!).

But that's a separate issue, the fact that the tab key can't be configured to simply insert a tab without setting the indentation mode to tabs throughout is much worse.

Revision history for this message
In , Dhaumann (dhaumann) wrote :

Switch to Command Line (F7), type 'char 9' and a tab is inserted

Revision history for this message
In , Kevin-kofler (kevin-kofler) wrote :

Unfortunately, that doesn't work either (it also inserts a bunch of spaces in space-indentation mode, at least in KWrite), and it isn't quite what I'm after anyway (8 keypresses all over the keyboard to insert 1 character).

Revision history for this message
In , Mildred (mildred) wrote :

What about creating a shortcut to do that ? for example shift+tab would do.
And of course you could change it.

Revision history for this message
In , CS (cs-redhat-bugs) wrote :

Description of problem:
New "feature" in Fedora 9/KDE4 is that Kate cannot increase indentation levels
using tabs. It can only use spaces. Previous versions of Kate used the
indentation found on the line. If it was indented with tabs, it added another
tab. If it was indented with spaces, it added more spaces.

Version-Release number of selected component (if applicable):
Kate 3.0.4/KDE 4.0.4

How reproducible:
Create a file (program/script). Indent with tabs. Highlight some code and
increase indentation level. It will add spaces, not tabs, to increase the
indentation level.

Steps to Reproduce:
1. Create code with tabs
2. Highlight part of the code
3. Increase indentation level

Actual results:
Spaces are added to increase indentation level.

Expected results:
An extra tab should be added to increase indentation level.

Additional info:
The expected response to this is, "Just use spaces, not tabs." However, I have
many years of code that uses tabs for indentation. I do not want to go through
600 gigs of code and convert all tabs to spaces just to make a bug in Kate feel
warm and fuzzy about itself.

Revision history for this message
In , Rex (rex-redhat-bugs) wrote :

This is (mostly likely) an upstream issue, not a fedora one. You'd be better
served reporting this to bugs.kde.org. When/if you, please let us know, so we
can continue to track the issue there.

Revision history for this message
In , CS (cs-redhat-bugs) wrote :

On bugs.kde.org, I found that the feature has not been removed. The redesign of
the configuration is a mess. If you set the tab level and indentation level to
the same number of characters, it will indent with tabs. Otherwise, it will
indent with spaces. There are complaints of inability to indent with spaces
(because both are the same) as well as inability to indent with tabs (because
they are set different). It is obvious that the configuration panel needs a
redesign to make it clear what the user is setting.

Revision history for this message
In , Kevin (kevin-redhat-bugs) wrote :

FYI, there are several bugs filed upstream about this and related issues, some
of them by me.

Revision history for this message
wateenellende (fpbeekhof) wrote :

Ok, if I give _4_ tabs, kate will replace the just-created 8 spaces by a tab.
Still very annoying.

Revision history for this message
Alex Rampp (bitschupser) wrote :

My Kate ignores the Tab settings completely and inserts the number of spaces I set in the intendation settings.

I've thested it with an empty and a C source file.

I'm using Kate 3.1.3
On KDE 4.1.3
On Kubuntu 8.10

Revision history for this message
Sebastian Lai (user17) wrote :

Same Problem for me. I've tested it by creating a testuser, and it still doesn't work.
Kate keeps replacing Tabs with 2 spaces (the length of spaces i have set in the Kate settings.).
This is a _really_ annoying Problem....
With KDE3 Kate everything worked fine!

Changed in kdesdk:
importance: Undecided → Low
status: New → Triaged
Changed in kdesdk:
status: Unknown → New
Revision history for this message
Tuukka Verho (tyverho) wrote :

This is because in Kate the tab key indents instead of inserting a tab character. If your indentation width is smaller than tab width, Kate inserts spaces. If indentation width is larger than tab width, indentation is done with a combination of tabs and spaces.

You get the desired behaviour if you set the tab width to the same as the indentation width.

I agree that this is very confusing. One should be able to set 'indent with tabs' and indentation width would then be determined by tab width.

Revision history for this message
wateenellende (fpbeekhof) wrote : Re: [Bug 282234] Re: kate ignores settings for TAB

Tuukka Verho wrote:
> This is because in Kate the tab key indents instead of inserting a tab
> character. If your indentation width is smaller than tab width, Kate
> inserts spaces. If indentation width is larger than tab width,
> indentation is done with a combination of tabs and spaces.
>
> You get the desired behaviour if you set the tab width to the same as
> the indentation width.
>
> I agree that this is very confusing. One should be able to set 'indent
> with tabs' and indentation width would then be determined by tab width.
>

What a marvelous user interface design choice! I see the developers took
the precaution of not putting the two settings in the same panel, lest
anyone might find out about a way to make kate behave as desired.

Wait, I've got another great idea: we should let users enter the desired
widths by tapping morse-code on the space bar! Or maybe we could force
them to use vi...

pffffffffff

I really like kate and I've used it for years, but a) this change was
really annoying; and b) the solution is sufficiently obscure that I
couldn't find it. In the mean time I switched to another editor (geany)
that can easily be configured to do what I want, and have no intention
of switching back.

Changed in kdesdk:
status: New → Fix Released
Changed in kdesdk:
status: Fix Released → Unknown
Changed in kdesdk:
status: Unknown → New
Revision history for this message
In , Cullmann-t (cullmann-t) wrote :

*** Bug 172950 has been marked as a duplicate of this bug. ***

Revision history for this message
In , ehamberg (hamberg) wrote :

i suggest doing it like vim does it: have one special key press who inserts whatever you press afterwards literally.

that way one can insert a tab even if tabs are set to expand to spaces, insert a special character like escape and so on.

in vim it is also possible to press number keys to insert an ascii code or, by prepending the numbers with 'u', insert a unicode char.

examples:

<key combo><tab> inserts a tab character
<key combo>009 inserts a tab character
<key combo>u0937 inserts a 'Ω'
<key combo>ux3c0 inserts a 'π' ('x' indicates hexadecimal)

Revision history for this message
Prateek Karandikar (prateek.karandikar) wrote :

This was affecting me too. I went to Settings->Configure Kate->Editor Component->Editing->Indentation->Indentation Actions and changed "Tab Key action" to "Always advance to the next tab position".

Kate Version 3.2.2
Using KDE 4.2.2
On Kubuntu 9.04

Changed in fedora:
status: Unknown → Invalid
Revision history for this message
David Siegel (djsiegel-deactivatedaccount) wrote :

This does not affect the default Ubuntu experience, therefore it is not a paper cut.

Changed in hundredpapercuts:
status: New → Invalid
Revision history for this message
In , gd2shoe (gd2shoe) wrote :

There's a reason I'm using kwrite instead of vim or emacs. If I wanted to use vim as my default editor, I would.

If you want to have an editor that replaces tabs with spaces by default, that's fine (though strongly not my preference). It must be intuitive to get them back, though. Anything less frustrates users.

MS style access to code-points is fine and all, but if I cannot make the tab key produce x09, then something is seriously wrong. Chew on that for a minute.

(Note that I did find the answer to my problem in bug report 172950. What should be intuitively obvious is as obscure as it could possibly be. I think most non-programmers still wouldn't be able to figure it out, let alone find the solution.)

The mantra that should be followed: Get out of my way and let me work!

Revision history for this message
Calabacin (raulgarciag) wrote :

It may work as you intended, but I consider this behaviour as a 'bug' in the design. If I untick 'Insert spaces instead of tabs', I expect it to insert tabs when I push TAB...

Changed in kdesdk:
importance: Unknown → Medium
Revision history for this message
Rajat Khanduja (rajatkhanduja13) wrote :

as Calabacin pointed, it is more of a bug than a 'feature'. The difference and choice is understandable but once the option of 'Insert spaces instead of tabs' has been unticked, the expected response is as in other editors, which is to not use Spaces for indentation at all.

Revision history for this message
In , Cullmann-t (cullmann-t) wrote :

In newer Kate versions, you can configure shortcut for "insert tab char".
If you don't enforce indent with spaces, tabs are insertable anyway, if you enforce indent with spaces, you can use that shortcut.

Revision history for this message
In , Kevin-kofler (kevin-kofler) wrote :

Uh, being able to set an obscure shortcut is no substitute for having the Tab key behave as designed.

Revision history for this message
In , Kevin-kofler (kevin-kofler) wrote :

Well, actually, Tab can be used as a shortcut, but:
* This is not a very intuitive way to set this up.
* The "insert tab" action does not behave like normal typing: For example, it always INSERTS a tab, even if you have text selected, it doesn't replace the selected text.
* Kate also messes with my indentation characters in other cases, e.g. when I paste stuff from the clipboard. So I can't even copy a line of code with unchanged indentation without changing my indentation settings all the time.

There really needs to be a "Don't mess with my indentation characters" option.

Revision history for this message
Marcus Haslam (marcus-haslam) wrote :

I'm out of the office until 1st August.

On 26 Apr 2011, at 17:11, Rajat Khanduja <email address hidden>
wrote:

> as Calabacin pointed, it is more of a bug than a 'feature'. The
> difference and choice is understandable but once the option of 'Insert
> spaces instead of tabs' has been unticked, the expected response is as
> in other editors, which is to not use Spaces for indentation at all.
>
> --
> You received this bug notification because you are a member of
> Papercutters, which is subscribed to One Hundred Paper Cuts.
> https://bugs.launchpad.net/bugs/282234
>
> Title:
>  kate ignores settings for TAB
>
> Status in One Hundred Paper Cuts:
>  Invalid
> Status in Software Development Kit from the official KDE4 release:
>  New
> Status in “kdesdk” package in Ubuntu:
>  Triaged
> Status in Fedora:
>  Invalid
>
> Bug description:
>  Binary package hint: kate
>
>  When I press TAB, I want to have a tabulator (no spaces), and have it
>  8 chars wide. This is in my config under "Editing", and in previous
>  versions was respected. The current version in Intrepid (see below
> for
>  details) ignores these settings, even though they are really set
>  correctly, and produces 2 spaces.
>
>  This is extremely annoying when typing source code, I now have to
>  copy-paste tabs from existing documents.
>
>  $ dpkg -s kate
>  Package: kate
>  Status: install ok installed
>  Priority: optional
>  Section: editors
>  Installed-Size: 2652
>  Maintainer: Kubuntu Developers <email address hidden>
>  Architecture: amd64
>  Source: kdesdk
>  Version: 4:4.1.2-0ubuntu1
>  Replaces: kate-kde4

Revision history for this message
In , Kevin-kofler (kevin-kofler) wrote :

There is also no way to set a shortcut for "insert tab char" in other applications embedding the KatePart, e.g. Krusader.

Revision history for this message
In , Cullmann-t (cullmann-t) wrote :

*** Bug 184260 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Kåre Särs (kare-sars-iki) wrote :

There was a bug that the "Insert Tab" action that it did not overwrite selected text, but that was fixed actually quite some time ago.

I am able to use the shortcut in KWrite and Kate... I think it should also appear in all applications that use the KatePart

It is not the nicest or most intuitive way but it gets it done... :)

Please reopen if it does not work in some situation. I will close this as fixed as the added Insert Tab action works for me.

Changed in kdesdk:
status: New → Fix Released
Changed in fedora:
importance: Unknown → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.