From 6636dcac56d381097ca671861fae56a745254cc4 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Thu, 17 Aug 2006 08:00:27 +0000 Subject: [PATCH] BTextView::DrawLines() was drawing some text over some already existing one. Fixes bug 738 (and also the weird text redrawing in Terminal and StyledEdit) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18518 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/BTextView/TextView.cpp | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/kits/interface/BTextView/TextView.cpp b/src/kits/interface/BTextView/TextView.cpp index 98f9d5ad1e..f3f8b38dd6 100644 --- a/src/kits/interface/BTextView/TextView.cpp +++ b/src/kits/interface/BTextView/TextView.cpp @@ -3561,15 +3561,6 @@ BTextView::DrawLines(int32 startLine, int32 endLine, int32 startOffset, bool era // erase only to the right of startOffset startEraseLine++; long startErase = startOffset; - // TODO ? What is this for ? - /*if (startErase > line->offset) { - for ( ; ((*fText)[startErase] != B_SPACE) && ((*fText)[startErase] != B_TAB); startErase--) { - if (startErase <= line->offset) - break; - } - if (startErase > line->offset) - startErase--; - }*/ BPoint erasePoint = PointAt(startErase); eraseRect.left = erasePoint.x; @@ -3578,8 +3569,7 @@ BTextView::DrawLines(int32 startLine, int32 endLine, int32 startOffset, bool era view->FillRect(eraseRect, B_SOLID_LOW); - eraseRect = clipRect; - startOffset = -1; + eraseRect = clipRect; } BRegion inputRegion; @@ -3587,9 +3577,14 @@ BTextView::DrawLines(int32 startLine, int32 endLine, int32 startOffset, bool era GetTextRegion(fInline->Offset(), fInline->Offset() + fInline->Length(), &inputRegion); float startLeft = fTextRect.left; - if (startOffset != -1) + if (startOffset != -1) { startLeft = PointAt(startOffset).x; - + if (ByteAt(startOffset) == B_ENTER) { + // StartOffset is a newline + startLeft = PointAt((*fLines)[startLine]->offset).x; + } + } + BPoint leftTop(startLeft, line->origin); for (long i = startLine; i <= endLine; i++) { long length = (line + 1)->offset; @@ -3670,7 +3665,7 @@ BTextView::DrawLines(int32 startLine, int32 endLine, int32 startOffset, bool era view->PopState(); } - + view->DrawString(fText->GetString(offset, tabChars), tabChars); if (foundTab) {