diff --git a/src/kits/interface/TextView.cpp b/src/kits/interface/TextView.cpp index b11b696a87..37c4a75077 100644 --- a/src/kits/interface/TextView.cpp +++ b/src/kits/interface/TextView.cpp @@ -3627,14 +3627,13 @@ BTextView::_HandleAlphaKey(const char *bytes, int32 numBytes) start = offset = OffsetAt(_LineAt(fSelStart)); while (ByteAt(offset) != '\0' && - (ByteAt(offset) == B_TAB || ByteAt(offset) == B_SPACE)) + (ByteAt(offset) == B_TAB || ByteAt(offset) == B_SPACE) + && offset < fSelStart) offset++; + _DoInsertText(bytes, numBytes, fSelStart, NULL); if (start != offset) _DoInsertText(Text() + start, offset - start, fSelStart, NULL); - - _DoInsertText(bytes, numBytes, fSelStart, NULL); - } else _DoInsertText(bytes, numBytes, fSelStart, NULL);