From 54ce349f97faa587ca51419ccf4f7471bc0c0425 Mon Sep 17 00:00:00 2001 From: Philippe Houdoin Date: Wed, 22 Sep 2010 09:44:21 +0000 Subject: [PATCH] Fix visual artifact !#1 described in #6530. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38783 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/terminal/TermView.cpp | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/src/apps/terminal/TermView.cpp b/src/apps/terminal/TermView.cpp index 34fc88c1a2..339b4ae630 100644 --- a/src/apps/terminal/TermView.cpp +++ b/src/apps/terminal/TermView.cpp @@ -1171,7 +1171,7 @@ TermView::_DrawCursor() int32 firstVisible = _LineAt(0); UTF8Char character; - uint32 attr; + uint32 attr = 0; bool cursorVisible = _IsCursorVisible(); @@ -1340,6 +1340,28 @@ TermView::Draw(BRect updateRect) int32 y1 = _LineAt(updateRect.top); int32 y2 = std::min(_LineAt(updateRect.bottom), (int32)fRows - 1); + // clear the area to the right of the line ends + if (y1 <= y2) { + float clearLeft = fColumns * fFontWidth; + if (clearLeft <= updateRect.right) { + BRect rect(clearLeft, updateRect.top, updateRect.right, + updateRect.bottom); + SetHighColor(kTermColorTable[0]); + FillRect(rect); + } + } + + // clear the area below the last line + if (y2 == fRows - 1) { + float clearTop = _LineOffset(fRows); + if (clearTop <= updateRect.bottom) { + BRect rect(updateRect.left, clearTop, updateRect.right, + updateRect.bottom); + SetHighColor(kTermColorTable[0]); + FillRect(rect); + } + } + // draw the affected line parts if (x1 <= x2) { uint32 attr = 0; @@ -1412,15 +1434,6 @@ TermView::Draw(BRect updateRect) i += count; } } - - if (y2 == fRows - 1) { - // There may be some empty space below the last line - BRect rect(updateRect.left, _LineOffset(fRows), - updateRect.right, 0); - rect.bottom = rect.top + fFontHeight - 1; - FillRect(rect); - } - } if (fInline && fInline->IsActive())