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
This commit is contained in:
Stefano Ceccherini 2004-12-30 07:59:24 +00:00
parent 7f7e65c79a
commit a5e772c9c2
1 changed files with 4 additions and 26 deletions

View File

@ -240,12 +240,10 @@ BTextView::BTextView(BMessage *archive)
InitObject(rect, NULL, NULL); InitObject(rect, NULL, NULL);
const char *text = NULL; const char *text = NULL;
if (archive->FindString("_text", &text) == B_OK) if (archive->FindString("_text", &text) == B_OK)
SetText(text); SetText(text);
int32 flag, flag2; int32 flag, flag2;
if (archive->FindInt32("_align", &flag) == B_OK) if (archive->FindInt32("_align", &flag) == B_OK)
SetAlignment((alignment)flag); SetAlignment((alignment)flag);
@ -1145,16 +1143,6 @@ BTextView::Insert(int32 startOffset, const char *inText, int32 inLength,
if (inLength < 1) if (inLength < 1)
return; return;
// hide the caret/unhilite the selection
if (fActive) {
if (fSelStart != fSelEnd)
Highlight(fSelStart, fSelEnd);
else {
if (fCaretVisible)
InvertCaret();
}
}
if (startOffset > TextLength()) if (startOffset > TextLength())
startOffset = TextLength(); startOffset = TextLength();
@ -1168,16 +1156,6 @@ BTextView::Insert(int32 startOffset, const char *inText, int32 inLength,
// recalc line breaks and draw the text // recalc line breaks and draw the text
Refresh(saveStart, startOffset, true, true); 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()) { if (clipboard->Lock()) {
clipboard->Clear(); clipboard->Clear();
BMessage *clip = NULL; BMessage *clip = clipboard->Data();
if ((clip = clipboard->Data()) != NULL) { if (clip != NULL) {
clip->AddData("text/plain", B_MIME_TYPE, Text() + fSelStart, clip->AddData("text/plain", B_MIME_TYPE, Text() + fSelStart,
fSelEnd - 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 \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 void
BTextView::DragCaret(int32 offset) BTextView::DragCaret(int32 offset)