Bug 223172

Summary: copy-pasting from scrollback buffer appends spaces at end of line
Product: [Applications] konsole Reporter: Alain Knaff <kde>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED DUPLICATE    
Severity: normal CC: khindenburg
Priority: NOR    
Version: 2.2.3   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Alain Knaff 2010-01-17 17:58:10 UTC
Version:           2.2.3 (using 4.2.4 (KDE 4.2.4), Kubuntu packages)
Compiler:          cc
OS:                Linux (x86_64) release 2.6.28-17-generic

When selecting a line which has scrolled off-screen, copy-pasting often appends a number of spaces to line.

How to reproduce:
1. In a shell, type "echo test"
2. You should see the following:
> echo test
test
3. Copy-paste both lines elsewhere (for example into an emacs)
4. Check the length of the pasted lines (for example, by moving into the line in your emacs, and then typing End, and see where the cursor ends up) => lines are ok.
5. Now, in konsole, type <Enter> often enough to make both lines scroll off screen
6. Use the scrollbar to bring them back into visibility.
7. Copy-paste them again into emacs
8. Now, the second line ("test") has enough spaces appended to make it as long as the preceding line ("> echo test")

Some tests with different commands show that the number of spaces depends on previously output lines of same shell command: there are always enough extra spaces added to make the pasted line as long as the longest preceding line of the same command (tested using head /etc/passwd).

It's weird how the bug only "takes into account" the lines making up the current command (command itself + any output), and seems to be reset for the next command.

Some further test showed that:
1. It can't be fooled neither with sleep's in the command, nor echo -n '> '
2. It does seem to depend on the shell used: it resets the current maximum length between commands in zsh, but not in bash
3. It behaves the same, no matter whether it's the shell launched directly by konsole, or a subshell. Weird stuff...
Comment 1 Kurt Hindenburg 2010-01-17 18:17:16 UTC

*** This bug has been marked as a duplicate of bug 188528 ***