From 73d0eee58c5c0de2b3b60ff99065bcca688bef72 Mon Sep 17 00:00:00 2001 From: Siarzhuk Zharski Date: Sun, 3 Mar 2013 22:06:50 +0100 Subject: [PATCH] Handle char attribute "holes" in Terminal History lines Previous implementation doesn't care about characters that are not covered by attributes run length array elements - so the attributes of the next run array element was taken instead of default one on the HistoryBuffer::GetTerminalLine() call. Note that this was the case of "holes" in run array but not the characters after the end of run array elements. --- src/apps/terminal/HistoryBuffer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/apps/terminal/HistoryBuffer.cpp b/src/apps/terminal/HistoryBuffer.cpp index 406477422f..9704af0426 100644 --- a/src/apps/terminal/HistoryBuffer.cpp +++ b/src/apps/terminal/HistoryBuffer.cpp @@ -88,7 +88,11 @@ HistoryBuffer::GetTerminalLineAt(int32 index, TerminalLine* buffer) const for (int32 i = 0; i < line->byteLength;) { // get attributes if (charCount == nextAttributesAt) { - if (attributesRunCount > 0) { + if (charCount < attributesRun->offset) { + // the "hole" in attributes run + attributes = 0; + nextAttributesAt = attributesRun->offset; + } else if (attributesRunCount > 0) { attributes = attributesRun->attributes; nextAttributesAt = attributesRun->offset + attributesRun->length;