From 58465926de9711d44a7b4849580d70456b9a3cc2 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Tue, 8 Sep 2009 03:46:37 +0000 Subject: [PATCH] Fix auto indent feature of BTextView. The indent was inserted before the line break instead of after. Also whitespace after the cursor position wasn't ignored. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32993 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/TextView.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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);