From ac834e963b412bfbead983784b071f7d4107efa3 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Thu, 16 Oct 2014 14:42:56 +0200 Subject: [PATCH] CTextBox: Fix center / right text display - The x position of the text could assume negative values, when the text length was greater than the specified range. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/a6487fd951f46be86135102e3c9bb8e5d287db69 Author: Michael Liebmann Date: 2014-10-16 (Thu, 16 Oct 2014) Origin message was: ------------------ CTextBox: Fix center / right text display - The x position of the text could assume negative values, when the text length was greater than the specified range. --- src/gui/widget/textbox.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index eca1e846c..0b91eee42 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -636,6 +636,7 @@ void CTextBox::refreshText(void) if ( m_nMode & SCROLL ) x_center -= SCROLL_FRAME_WIDTH; } + x_center = std::max(x_center, 0); //TRACE("[CTextBox] %s Line %d m_cFrame.iX %d m_cFrameTextRel.iX %d\r\n", __FUNCTION__, __LINE__, m_cFrame.iX, m_cFrameTextRel.iX); m_pcFontText->RenderString(m_cFrame.iX + m_cFrameTextRel.iX + text_Hborder_width + x_center,