From c06e28719b063bb3cb05b529b43b188538e864b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sat, 4 Apr 2009 22:40:58 +0000 Subject: [PATCH] Patch by Olivier Coursiere: Fixes ticket #3673. Thanks a lot! NOTE: There are some more problems with regard to this, if you resize DeskCalc (which sets a new font size on the expression view, and then type something, the newly typed stuff will have the old font still...) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29911 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/TextView.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/kits/interface/TextView.cpp b/src/kits/interface/TextView.cpp index 0484af0187..222c54da77 100644 --- a/src/kits/interface/TextView.cpp +++ b/src/kits/interface/TextView.cpp @@ -1658,7 +1658,24 @@ BTextView::SetRunArray(int32 startOffset, int32 endOffset, _CancelInputMethod(); - _SetRunArray(startOffset, endOffset, inRuns); + const text_run_array *runs = inRuns; + + text_run_array oneRun; + + if (!fStylable) { + // When the text view is not stylable, we always set the whole text's + // style with the first run and ignore the offsets + if (inRuns->count == 0) + return; + startOffset = 0; + endOffset = fText->Length(); + oneRun.count = 1; + oneRun.runs[0] = inRuns->runs[0]; + oneRun.runs[0].offset = 0; + runs = &oneRun; + } + + _SetRunArray(startOffset, endOffset, runs); _Refresh(startOffset, endOffset, true, false); } @@ -2960,7 +2977,7 @@ BTextView::InsertText(const char *inText, int32 inLength, int32 inOffset, // update the style runs fStyles->BumpOffset(inLength, fStyles->OffsetToRun(inOffset - 1) + 1); - if (inRuns != NULL) { + if (fStylable && (inRuns != NULL)) { _SetRunArray(inOffset, inOffset + inLength, inRuns); } else { // apply nullStyle to inserted text