From 0b6b71e99a06634465c346d8dae04b9edb69dc62 Mon Sep 17 00:00:00 2001 From: shatty Date: Thu, 31 Jul 2003 09:08:21 +0000 Subject: [PATCH] flank more carefully change marking actions, return the result from convert_to_utf8 git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4164 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/stylededit/StyledEditView.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/apps/stylededit/StyledEditView.cpp b/src/apps/stylededit/StyledEditView.cpp index 4755ce0d5b..36a218aeb3 100644 --- a/src/apps/stylededit/StyledEditView.cpp +++ b/src/apps/stylededit/StyledEditView.cpp @@ -58,15 +58,18 @@ StyledEditView::FrameResized(float width, float height) */ } + +#include + status_t StyledEditView::GetStyledText(BPositionIO * stream) { status_t result = B_OK; - fSuppressChanges = true; - + + fSuppressChanges = true; result = BTranslationUtils::GetStyledText(stream, this, NULL); + fSuppressChanges = false; if (result != B_OK) { - fSuppressChanges = false; return result; } @@ -113,7 +116,9 @@ StyledEditView::GetStyledText(BPositionIO * stream) int32 length = stream->Seek(0,SEEK_END); text_run_array * run_array = RunArray(0,length); uint32 id = BCharacterSetRoster::GetCharacterSetByFontID(fEncoding)->GetConversionID(); + fSuppressChanges = true; SetText(""); + fSuppressChanges = false; char inBuffer[256]; off_t location = 0; int32 textOffset = 0; @@ -125,8 +130,13 @@ StyledEditView::GetStyledText(BPositionIO * stream) int32 textLength = 256; int32 bytes = bytesRead; while (textLength > 0) { - convert_to_utf8(id,inPtr,&bytes,textBuffer,&textLength,&state); + result = convert_to_utf8(id,inPtr,&bytes,textBuffer,&textLength,&state); + if (result != B_OK) { + return result; + } + fSuppressChanges = true; InsertText(textBuffer,textLength,textOffset); + fSuppressChanges = false; textOffset += textLength; inPtr += bytes; location += bytes; @@ -139,7 +149,6 @@ StyledEditView::GetStyledText(BPositionIO * stream) } SetRunArray(0,length,run_array); } - fSuppressChanges = false; return result; }