Closing #5959:
* _DoInsertText() must not assume that the text is actually being inserted by InsertText(), since that's a virtual method meant to be overridden by subclasses. So the updating of caret-position and selection start/end has to happen in InsertText(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38006 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
cb06c64a5d
commit
e70da3e14c
@ -3039,6 +3039,12 @@ BTextView::InsertText(const char *inText, int32 inLength, int32 inOffset,
|
||||
|
||||
// update the style runs
|
||||
fStyles->BumpOffset(inLength, fStyles->OffsetToRun(inOffset - 1) + 1);
|
||||
|
||||
// offset the caret/selection, if the text was inserted before it
|
||||
if (inOffset <= fSelEnd) {
|
||||
fSelStart += inLength;
|
||||
fCaretOffset = fSelEnd = fSelStart;
|
||||
}
|
||||
}
|
||||
|
||||
if (fStylable && inRuns != NULL) {
|
||||
@ -4202,12 +4208,6 @@ BTextView::_DoInsertText(const char *inText, int32 inLength, int32 inOffset,
|
||||
// copy data into buffer
|
||||
InsertText(inText, inLength, inOffset, inRuns);
|
||||
|
||||
// offset the caret/selection, if the text was inserted before it
|
||||
if (inOffset <= fSelEnd) {
|
||||
fSelStart += inLength;
|
||||
fCaretOffset = fSelEnd = fSelStart;
|
||||
}
|
||||
|
||||
// recalc line breaks and draw the text
|
||||
_Refresh(inOffset, inOffset + inLength, false);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user