From c1513476b3d726a9e43f12bfb97e8f2058cb566c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Tue, 4 Nov 2008 10:54:34 +0000 Subject: [PATCH] SetWordWrap() did not work when the BTextView was not (yet) attached to a window this fixes the tool tip size/layout in apps that use BubbleHelper (Beam, WonderBrush, ...). Thanks to Rene and Stefano for sending me a test application. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28489 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/TextView.cpp | 39 ++++++++++++++++----------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/src/kits/interface/TextView.cpp b/src/kits/interface/TextView.cpp index 9deee35abb..9d63acfed2 100644 --- a/src/kits/interface/TextView.cpp +++ b/src/kits/interface/TextView.cpp @@ -2348,28 +2348,27 @@ BTextView::SetWordWrap(bool wrap) { if (wrap == fWrap) return; - - if (Window() != NULL) { - if (fActive) { - // hide the caret, unhilite the selection - if (fSelStart != fSelEnd) - Highlight(fSelStart, fSelEnd); - else { - _HideCaret(); - } - } - - fWrap = wrap; - _Refresh(0, fText->Length(), true, true); - - if (fActive) { - // show the caret, hilite the selection - if (fSelStart != fSelEnd && fSelectable) - Highlight(fSelStart, fSelEnd); - else - _ShowCaret(); + + bool updateOnScreen = fActive && Window() != NULL; + if (updateOnScreen) { + // hide the caret, unhilite the selection + if (fSelStart != fSelEnd) + Highlight(fSelStart, fSelEnd); + else { + _HideCaret(); } } + + fWrap = wrap; + _Refresh(0, fText->Length(), true, true); + + if (updateOnScreen) { + // show the caret, hilite the selection + if (fSelStart != fSelEnd && fSelectable) + Highlight(fSelStart, fSelEnd); + else + _ShowCaret(); + } }