[Konsole-devel] [Bug 90201] copy / paste removes whitespace if it is the last character of wrapping line

Jeff Mitchell kde-dev at emailgoeshere.com
Thu Sep 25 12:53:59 UTC 2008


http://bugs.kde.org/show_bug.cgi?id=90201


Jeff Mitchell kde-dev emailgoeshere com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |robertknight at gmail.com, kde-
                   |                            |dev at emailgoeshere.com




--- Comment #8 from Jeff Mitchell <kde-dev emailgoeshere com>  2008-09-25 14:53:57 ---
At Robert's request, I did some digging.  Here's what I found:

I took a look at this.  After looking at the code in
Konsole::Screen::copyLineToStream(), I checked whether the 
behavior was different when copying from the history vs. the current screen 
image, and it is -- so the culprit seems to be this code, which is run only if 
copying from the current screen image.

            // ignore trailing white space at the end of the line
            for (int i = length-1; i >= 0; i--)
                if (data[i].character == ' ')
                    length--;
                else
                    break;


I'm not entirely sure what to do -- the only thing I can think of is to change 
it so that a single space character is allowed.  i.e. (with appropriate checks 
for valid array values)

if (data[i].character == ' ' && data[i-1].character == ' ')
        length--;

What do you think?  Alternately, the code could be removed entirely or changed 
to whatever happens when it goes into the history buffer -- when copying from 
the history, it says:  

            // retrieve line from history buffer.  It is assumed
            // that the history buffer does not store trailing white space
            // at the end of the line, so it does not need to be trimmed here

Obviously this isn't true as doing my copy from the history buffer does 
properly keep the spaces in...


-- 
Configure bugmail: http://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the konsole-devel mailing list