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.
This commit is contained in:
Stefan Seyfried
2017-01-29 21:27:45 +01:00
committed by svenhoefer
parent 85bb568d02
commit b623aad5c3

View File

@@ -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);