From 17b889de67dceb1f0327f5e936b0182a9655094b Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sun, 15 Jun 2008 01:02:55 +0000 Subject: [PATCH] * 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 --- src/apps/terminal/BasicTerminalBuffer.cpp | 11 ++++++----- src/apps/terminal/TerminalLine.h | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/apps/terminal/BasicTerminalBuffer.cpp b/src/apps/terminal/BasicTerminalBuffer.cpp index ef144a29ad..a1a1c6a7fd 100644 --- a/src/apps/terminal/BasicTerminalBuffer.cpp +++ b/src/apps/terminal/BasicTerminalBuffer.cpp @@ -135,7 +135,8 @@ BasicTerminalBuffer::Init(int32 width, int32 height, int32 historySize) return error; } - _ClearLines(0, fHeight - 1); + for (int32 i = 0; i < fHeight; i++) + fScreen[i]->Clear(); fDirtyInfo.Reset(); @@ -764,9 +765,9 @@ BasicTerminalBuffer::_ClearLines(int32 first, int32 last) if (firstCleared == -1) firstCleared = i; lastCleared = i; - - line->Clear(); } + + line->Clear(); } if (firstCleared >= 0) @@ -864,8 +865,8 @@ BasicTerminalBuffer::_ResizeSimple(int32 width, int32 height, TerminalLine* destLine = lines[i - firstLine]; if (width < fWidth) _TruncateLine(sourceLine, width); - memcpy(destLine, sourceLine, sizeof(TerminalLine) - + (sourceLine->length - 1) * sizeof(TerminalCell)); + memcpy(destLine, sourceLine, (int32)sizeof(TerminalLine) + + (sourceLine->length - 1) * (int32)sizeof(TerminalCell)); } // clear the remaining lines diff --git a/src/apps/terminal/TerminalLine.h b/src/apps/terminal/TerminalLine.h index da5d12dda2..195069ec0c 100644 --- a/src/apps/terminal/TerminalLine.h +++ b/src/apps/terminal/TerminalLine.h @@ -17,7 +17,7 @@ struct TerminalCell { struct TerminalLine { - int16 length; + uint16 length; bool softBreak; // soft line break TerminalCell cells[1];