From f1a0cc2351bad4dfe8275983a7d4ad8ad61f1f2e Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 28 Jan 2017 23:37:45 +0100 Subject: [PATCH] textbox: fix output for BOTTOM mode If more text is added to a textbox than fits into the window, the last lines are stripped. In BOTTOM (and non-SCROLL) mode, it makes more sense to strip the first lines. This is used by shellwindow, e.g. in package management menu. --- src/gui/widget/textbox.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index 4750de544..043ffbaac 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -679,11 +679,14 @@ void CTextBox::refreshText(void) if (m_nMode & TOP) // move to top of frame y += m_nFontTextHeight + ((m_cFrameTextRel.iHeight - m_nFontTextHeight * m_nLinesPerPage) >> 1); - else if (m_nMode & BOTTOM) + else if (m_nMode & BOTTOM) { + /* if BOTTOM && !SCROLL, show the last lines if more than one page worth of text is in cLineArray */ + if (!(m_nMode & SCROLL) && (m_nNrOfLines > m_nLinesPerPage)) + m_nCurrentLine = m_nNrOfLines - m_nLinesPerPage; // move to bottom of frame y += m_cFrameTextRel.iHeight - (lines > 1 ? (lines - 1)*m_nFontTextHeight : 0) - text_Vborder_width; //m_nFontTextHeight + text_Vborder_width /*- ((m_cFrameTextRel.iHeight + m_nFontTextHeight*/ * m_nLinesPerPage/*) >> 1)*/; - else + } else // fit into mid of frame space y += m_nFontTextHeight + ((m_cFrameTextRel.iHeight - m_nFontTextHeight * lines) >> 1);