From d7dc44146c625c366a2f0ff70d901a4f953b8ee6 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 18 Sep 2012 09:41:57 +0100 Subject: [PATCH] *CTextBox: add missed init of lineBreakWidth lineBreakWidth is not initialized, but some othe values also not defined, here is seems somthing wrong --- src/gui/widget/textbox.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index 657ecf559..17998be9b 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -295,7 +295,7 @@ void CTextBox::refreshTextLineArray(void) int pos = 0; int aktWidth = 0; int aktWordWidth = 0; - int lineBreakWidth; + int lineBreakWidth = 0; int maxTextWidth = 0; m_nNrOfNewLine = 0; @@ -307,15 +307,20 @@ void CTextBox::refreshTextLineArray(void) m_cLineArray.clear(); m_nNrOfLines = 0; - if( m_nMode & AUTO_WIDTH) + if( m_nMode & AUTO_WIDTH){ /* In case of autowidth, we calculate the max allowed width of the textbox */ lineBreakWidth = MAX_WINDOW_WIDTH - m_cFrameScrollRel.iWidth - 2*text_border_width; - else + + }else{ /* If not autowidth, we just take the actuall textframe width */ lineBreakWidth = m_cFrameTextRel.iWidth - 2*text_border_width; + } + if(max_width) lineBreakWidth = max_width; - //printf("TextBox: lineBreakWidth %d\n", lineBreakWidth); + + //TRACE("[CTextBox] line %d: lineBreakWidth %d\n", __LINE__, lineBreakWidth); + int TextChars = m_cText.size(); // do not parse, if text is empty if(TextChars > 0)