Bug 223193

Summary: mouse text selection: _sometimes_ copying a lot of unexisting spaces instead of newline character at the end of line to the X buffer
Product: [Applications] konsole Reporter: DEK <dmitryk>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED DUPLICATE    
Severity: normal CC: dmitryk
Priority: NOR    
Version: 2.3.3   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description DEK 2010-01-17 20:03:29 UTC
Version:           2.3.3 (using KDE 4.3.3)
Compiler:          gcc version 4.3.4 (Gentoo 4.3.4 p1.0, pie-10.1.5) -O2 -pipe -mtune=nocona -march=nocona
OS:                Linux
Installed from:    Gentoo Packages

selection - I mean simple mouse selection with copying to X buffer

It occurs only with a big number of selected lines (somewhere above one hundred lines).
Some of them are copied to X buffer with a lot of space characters instead of one newline character.

Way to reproduce (for example):
$ for N in `seq 1 1 51` ; do echo -e "$N\ta\t\tb\t\tc\t\t\t\t\n\tzz\nasd\tbzk\n bg" ; done
$

After that select the output with your mouse and paste it by the middle mouse button into any text editor (nano, for example).
Then select it and paste it again.
Look at the results.
There will be a number of lines, that do not end with just \n, but have a lot of spaces before it.

Instead of nano you can use just something like that:
$ cat <<EOF | wc -c
and paste text from X buffer to cat.
Number of characters will differ between two selections of the same text.

PS sorry for my poor english
Comment 1 DEK 2010-01-17 20:39:05 UTC
some additional information (not sure if it is useful or it is not).

have installed konsole from KDE 3.5.10 in a different slot
$ /usr/kde/3.5/bin/konsole -v
Qt: 3.3.8b
KDE: 3.5.10
Konsole: 1.6.6
$
tested the same things in Konsole 1.6.6 still using KDE 4.3.3 and everything is OK there.
so, Konsole 1.6.6 is OK, Konsole 2.3.3 is not.
Comment 2 DEK 2010-01-17 21:24:25 UTC
hmm.. one more thing..
such lines with spaces are always before normal lines.
For example if i select two hundred of lines in konsole and then paste it i will have first 53 lines with spaces before \n, and the last 147 lines will be OK. 
Next time i select the same text i will have first 112 lines with spaces before \n, and the last 88 lines will be OK.

and one more
if the first line contains for example 15 characters and the second line contains 25 characters and after copying and pasting the first line becomes a line with first 15 characters and 90 spaces after them and before \n , then the second line (if it is buggy too) will have 25 its characters and 80 spaces before \n. 15+90=25+80.
the number of characters in such buggy lines is always the same during one copy/paste action.
Comment 3 Matthew Woehlke 2010-01-20 01:11:36 UTC

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