* Changed TerminalLine::length from int16 to uint16.

* BasicTerminalBuffer::Init() no longer uses _ClearLines() to clear
  the screen lines, since that expects the lines to be somewhat valid
  at least and also needlessly updates the dirty region.
* _ClearLines() always clears lines, even if they were empty. This way
  the "softBreak" flag is cleared too.
* Be a bit more careful when multiplying a potentially negative signed
  number by an unsigned one. Shouldn't have caused a problem in this
  case, though.

Either of the first three items should fix #2379.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25958 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2008-06-15 01:02:55 +00:00
parent 4c9d4b02ef
commit 17b889de67
2 changed files with 7 additions and 6 deletions
+5 -4
View File
@@ -135,7 +135,8 @@ BasicTerminalBuffer::Init(int32 width, int32 height, int32 historySize)
return error; return error;
} }
_ClearLines(0, fHeight - 1); for (int32 i = 0; i < fHeight; i++)
fScreen[i]->Clear();
fDirtyInfo.Reset(); fDirtyInfo.Reset();
@@ -764,10 +765,10 @@ BasicTerminalBuffer::_ClearLines(int32 first, int32 last)
if (firstCleared == -1) if (firstCleared == -1)
firstCleared = i; firstCleared = i;
lastCleared = i; lastCleared = i;
}
line->Clear(); line->Clear();
} }
}
if (firstCleared >= 0) if (firstCleared >= 0)
_Invalidate(firstCleared, lastCleared); _Invalidate(firstCleared, lastCleared);
@@ -864,8 +865,8 @@ BasicTerminalBuffer::_ResizeSimple(int32 width, int32 height,
TerminalLine* destLine = lines[i - firstLine]; TerminalLine* destLine = lines[i - firstLine];
if (width < fWidth) if (width < fWidth)
_TruncateLine(sourceLine, width); _TruncateLine(sourceLine, width);
memcpy(destLine, sourceLine, sizeof(TerminalLine) memcpy(destLine, sourceLine, (int32)sizeof(TerminalLine)
+ (sourceLine->length - 1) * sizeof(TerminalCell)); + (sourceLine->length - 1) * (int32)sizeof(TerminalCell));
} }
// clear the remaining lines // clear the remaining lines
+1 -1
View File
@@ -17,7 +17,7 @@ struct TerminalCell {
struct TerminalLine { struct TerminalLine {
int16 length; uint16 length;
bool softBreak; // soft line break bool softBreak; // soft line break
TerminalCell cells[1]; TerminalCell cells[1];