From a5e772c9c2b948d905acd439fda9d6b87e11597e Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Thu, 30 Dec 2004 07:59:24 +0000 Subject: [PATCH] Fixed the other bug reported by Axel: the blinking caret spuriously drawn at a wrong position. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10546 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/BTextView/TextView.cpp | 30 +++-------------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/src/kits/interface/BTextView/TextView.cpp b/src/kits/interface/BTextView/TextView.cpp index 9c3aea874e..d59db824c8 100644 --- a/src/kits/interface/BTextView/TextView.cpp +++ b/src/kits/interface/BTextView/TextView.cpp @@ -240,12 +240,10 @@ BTextView::BTextView(BMessage *archive) InitObject(rect, NULL, NULL); const char *text = NULL; - if (archive->FindString("_text", &text) == B_OK) SetText(text); int32 flag, flag2; - if (archive->FindInt32("_align", &flag) == B_OK) SetAlignment((alignment)flag); @@ -1145,16 +1143,6 @@ BTextView::Insert(int32 startOffset, const char *inText, int32 inLength, if (inLength < 1) return; - // hide the caret/unhilite the selection - if (fActive) { - if (fSelStart != fSelEnd) - Highlight(fSelStart, fSelEnd); - else { - if (fCaretVisible) - InvertCaret(); - } - } - if (startOffset > TextLength()) startOffset = TextLength(); @@ -1168,16 +1156,6 @@ BTextView::Insert(int32 startOffset, const char *inText, int32 inLength, // recalc line breaks and draw the text Refresh(saveStart, startOffset, true, true); - - // draw the caret/hilite the selection - if (fActive) { - if (fSelStart != fSelEnd) - Highlight(fSelStart, fSelEnd); - else { - if (!fCaretVisible) - InvertCaret(); - } - } } @@ -1341,8 +1319,8 @@ BTextView::Copy(BClipboard *clipboard) if (clipboard->Lock()) { clipboard->Clear(); - BMessage *clip = NULL; - if ((clip = clipboard->Data()) != NULL) { + BMessage *clip = clipboard->Data(); + if (clip != NULL) { clip->AddData("text/plain", B_MIME_TYPE, Text() + fSelStart, fSelEnd - fSelStart); @@ -3847,9 +3825,9 @@ BTextView::InvertCaret() } -/*! \brief Place the blinking caret at the given offset. +/*! \brief Place the dragging caret at the given offset. \param offset The offset (zero based within the object's text) where to place - the blinking caret. If it's -1, hide the caret. + the dragging caret. If it's -1, hide the caret. */ void BTextView::DragCaret(int32 offset)