From e26ad6e9f1970d82d5a2b80315acf67b526c228e Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Thu, 3 Nov 2016 12:51:31 +0100 Subject: [PATCH] src/gui/widget/textbox.cpp supplement to try to fix text lines per page --- src/gui/widget/textbox.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index 5651d302c..428063a4f 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -310,8 +310,9 @@ void CTextBox::initFramesRel(void) m_cFrameTextRel.iWidth = m_cFrame.iWidth - m_cFrameScrollRel.iWidth; - m_nLinesPerPage = std::max(1, (m_cFrameTextRel.iHeight - (2*text_Vborder_width)) / m_nFontTextHeight); - if((m_cFrameTextRel.iHeight - (2*text_Vborder_width)) % m_nFontTextHeight) + int lines_per_page_tmp = (m_cFrameTextRel.iHeight - (2*text_Vborder_width)) / m_nFontTextHeight; + m_nLinesPerPage = std::max(1,lines_per_page_tmp); + if(lines_per_page_tmp && (m_cFrameTextRel.iHeight - (2*text_Vborder_width)) % m_nFontTextHeight) m_nLinesPerPage += 1; #if 0 @@ -467,8 +468,9 @@ void CTextBox::refreshTextLineArray(void) reSizeMainFrameHeight(m_nNrOfLines * m_nFontTextHeight); } - m_nLinesPerPage = std::max(1, (m_cFrameTextRel.iHeight - (2*text_Vborder_width)) / m_nFontTextHeight); - if((m_cFrameTextRel.iHeight - (2*text_Vborder_width)) % m_nFontTextHeight) + int lines_per_page_tmp = (m_cFrameTextRel.iHeight - (2*text_Vborder_width)) / m_nFontTextHeight; + m_nLinesPerPage = std::max(1, lines_per_page_tmp); + if(lines_per_page_tmp && (m_cFrameTextRel.iHeight - (2*text_Vborder_width)) % m_nFontTextHeight) m_nLinesPerPage += 1; m_nNrOfPages = ((m_nNrOfLines-1) / m_nLinesPerPage) + 1;