[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/apps/konsole/src
From: Robert Knight <robertknight () gmail ! com>
Date: 2008-02-29 21:57:51
Message-ID: 1204322271.245790.16016.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 780739 by knight:
Allow selection of the new line character at the end of the last line of the \
selection. When the cursor goes beyond the end of the text on the last line of the \
selection, a new line character is added to the text sent to the clipboard. This \
behaviour is consistent with Konsole in KDE 3.5
M +21 -7 Screen.cpp
M +5 -2 Screen.h
--- trunk/KDE/kdebase/apps/konsole/src/Screen.cpp #780738:780739
@@ -1320,17 +1320,29 @@
if ( y == bottom || columnmode ) count = right - start + 1;
const bool appendNewLine = ( y != bottom );
- copyLineToStream( y,
- start,
- count,
- decoder,
- appendNewLine,
- preserveLineBreaks );
+ int copied = copyLineToStream( y,
+ start,
+ count,
+ decoder,
+ appendNewLine,
+ preserveLineBreaks );
+
+ // if the selection goes beyond the end of the last line then
+ // append a new line character.
+ //
+ // this makes it possible to 'select' a trailing new line character after
+ // the text on a line.
+ if ( y == bottom &&
+ copied < count )
+ {
+ Character newLineChar('\n');
+ decoder->decodeLine(&newLineChar,1,0);
+ }
}
}
-void Screen::copyLineToStream(int line ,
+int Screen::copyLineToStream(int line ,
int start,
int count,
TerminalCharacterDecoder* decoder,
@@ -1421,6 +1433,8 @@
//decode line and write to text stream
decoder->decodeLine( (Character*) characterBuffer ,
count, currentLineProperties );
+
+ return count;
}
// Method below has been removed because of its reliance on 'histCursor'
--- trunk/KDE/kdebase/apps/konsole/src/Screen.h #780738:780739
@@ -540,14 +540,17 @@
private:
//copies a line of text from the screen or history into a stream using a
- //specified character decoder
+ //specified character decoder. Returns the number of lines actually copied,
+ //which may be less than 'count' if (start+count) is more than the number of \
characters on + //the line
+ //
//line - the line number to copy, from 0 (the earliest line in the history) up to
// hist->getLines() + lines - 1
//start - the first column on the line to copy
//count - the number of characters on the line to copy
//decoder - a decoder which coverts terminal characters (an Character array) into \
text
//appendNewLine - if true a new line character (\n) is appended to the end of \
the line
- void copyLineToStream(int line,
+ int copyLineToStream(int line,
int start,
int count,
TerminalCharacterDecoder* decoder,
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic