This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Konsole and tab characters

Tags: konsole konsole konsole
(comma "," separated)
h4rm0ny
Registered Member
Posts
2
Karma
0

Konsole and tab characters

Wed Aug 11, 2010 10:11 am
I tried searching for the answer, but keywords like "KDE space tab" generate a lot of results. This forum seemed the best fit for my somewhat odd question.

It's probably simple. When using Konsole, and I have some quantity of text I've highlighted which includes tab characters, and I then attempt to paste that into Konsole, such as into a program like 'vi', the tab character gets turned into spaces. I need it to remain a tab character. I believe this is konsole rather than any program running in it as it turns a tab character into spaces just at the normal shell prompt as well.

Can anyone tell me what to change and where, to get it to keep tabs as tabs, please? This would remove a a growing annoyance for me. If relevant, the platform is Kubuntu Lucid Lynx.

Many thanks,

H.
john_hudson
Registered Member
Posts
549
Karma
2
OS

Re: Konsole and tab characters

Wed Aug 11, 2010 5:58 pm
I think the problem is nothing to do with Konsole and everything to do with BASH. man bash shows the definition: blank A space or tab - in other words BASH does not distinguish them. Maybe Konsole translates a tab into a fixed number of spaces but they are conceptually the same to BASH.


John Hudson, proud to be a member of KDE forums since 2008-Oct.
User avatar
google01103
Manager
Posts
6668
Karma
25

Re: Konsole and tab characters

Wed Aug 11, 2010 8:04 pm
I did a little test where I copied a string created in Kate that included tabs and then pasted it into both a Konsole bash session and a vi session and tabs were retained in both cases.

In the Konsole session the paste initiated a auto completion response (?) of "Display all 4405 possibilities? (y or n)". In vi use of the backspace key indicated tabs were copied.

Maybe the Klipper setting of "remove whitespaces when executing actions" is your problem. Or maybe in Kate (if that's what you're using) you have "Indent using" set to Spaces instead of Tabulators?


OpenSuse Leap 42.1 x64, Plasma 5.x

User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Konsole and tab characters

Thu Aug 12, 2010 5:04 am
The problem likely occurs when copying from Vim in Konsole, that will result in Spaces not tabs ( at least in my testing )


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
h4rm0ny
Registered Member
Posts
2
Karma
0

Re: Konsole and tab characters

Mon Aug 16, 2010 8:46 am
bcooksley wrote:The problem likely occurs when copying from Vim in Konsole, that will result in Spaces not tabs ( at least in my testing )


Yes. This is exactly where I'm having the problem. I found a reference to someone solving this elsewhere, but not actually how to do it.

Thanks for your help,

H.
User avatar
unhammer
Registered Member
Posts
53
Karma
0
OS

Re: Konsole and tab characters

Thu Jun 02, 2011 12:10 pm
still no solution? I have the same problem, any TAB I copy-paste from Konsole (whether bash or vim) is turned into spaces.

(On a related note, when I paste a tab into bash, it's just removed, so 'fooTABbar' turns into 'foobar', but this does _not_ happen in vim... EDIT: of course, this happens because bash wants to expand on the tab. OK, so not related to the OP question, though it would be nice if Konsole could escape pasted tabs.)
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Konsole and tab characters

Thu Jun 02, 2011 11:37 pm
Perhaps this is due to limitations in the PTY protocol, which don't allow Konsole to accurately determine the characters that are present? Have you filed a bug?


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
airdrik
Registered Member
Posts
1854
Karma
5
OS

Re: Konsole and tab characters

Fri Jun 03, 2011 2:41 pm
I did some testing and found that both gnome-terminal and Terminal (from xfce) both display and allow selecting of tab characters as a single character (the desired behavior), whereas Konsole displays tab characters as the number of spaces needed to fill to the next tab stop (every 8 characters).
On the other hand, if you copy text from another source (e.g. kate) which contains tabs and paste into konsole, it properly inserts the tab characters (which are handled by whatever is currently managing stdin)

Looks like the bug has already been reported (a couple of times):
https://bugs.kde.org/show_bug.cgi?id=240929


airdrik, proud to be a member of KDE forums since 2008-Dec.


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell