Commit 17c3b962 authored by Tomaz  Canabrava's avatar Tomaz Canabrava Committed by Tomaz Canabrava
Browse files

Fix block selection on reflowed lines

parent d3080e7f
...@@ -1430,6 +1430,7 @@ void Screen::writeToStream(TerminalCharacterDecoder* decoder, ...@@ -1430,6 +1430,7 @@ void Screen::writeToStream(TerminalCharacterDecoder* decoder,
count, count,
decoder, decoder,
appendNewLine, appendNewLine,
_blockSelectionMode,
options); options);
// if the selection goes beyond the end of the last line then // if the selection goes beyond the end of the last line then
...@@ -1479,6 +1480,7 @@ int Screen::copyLineToStream(int line , ...@@ -1479,6 +1480,7 @@ int Screen::copyLineToStream(int line ,
int count, int count,
TerminalCharacterDecoder* decoder, TerminalCharacterDecoder* decoder,
bool appendNewLine, bool appendNewLine,
bool isBlockSelectionMode,
const DecodingOptions options) const const DecodingOptions options) const
{ {
const int lineLength = getLineLength(line); const int lineLength = getLineLength(line);
...@@ -1550,7 +1552,10 @@ int Screen::copyLineToStream(int line , ...@@ -1550,7 +1552,10 @@ int Screen::copyLineToStream(int line ,
} }
if (appendNewLine) { if (appendNewLine) {
if ((currentLineProperties & LINE_WRAPPED) != 0) { if (isBlockSelectionMode) {
characterBuffer[count] = options.testFlag(PreserveLineBreaks) ? Character('\n') : Character(' ');
count++;
} else if ((currentLineProperties & LINE_WRAPPED) != 0) {
// do nothing extra when this line is wrapped. // do nothing extra when this line is wrapped.
} else { } else {
// When users ask not to preserve the linebreaks, they usually mean: // When users ask not to preserve the linebreaks, they usually mean:
......
...@@ -613,8 +613,9 @@ private: ...@@ -613,8 +613,9 @@ private:
//count - the number of characters on the line to copy //count - the number of characters on the line to copy
//decoder - a decoder which converts terminal characters (an Character array) into text //decoder - a decoder which converts terminal characters (an Character array) into text
//appendNewLine - if true a new line character (\n) is appended to the end of the line //appendNewLine - if true a new line character (\n) is appended to the end of the line
//isBlockSelectionMode - takes that in consideration while appending a new line.
int copyLineToStream(int line, int start, int count, TerminalCharacterDecoder *decoder, int copyLineToStream(int line, int start, int count, TerminalCharacterDecoder *decoder,
bool appendNewLine, const DecodingOptions options) const; bool appendNewLine, bool isBlockSelectionMode, const DecodingOptions options) const;
//fills a section of the screen image with the character 'c' //fills a section of the screen image with the character 'c'
//the parameters are specified as offsets from the start of the screen image. //the parameters are specified as offsets from the start of the screen image.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment