From b623aad5c3fe567f157f187786787e7a932c2ddd Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 29 Jan 2017 21:27: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 cb8bbb1e0..e669687ae 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);