mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-26 02:08:28 +02:00
Show at least one row per page
In theory a font could be so large that no full row would fit on the allotted space; in that case showing a partial row is better than nothing and will avoid bugs where -1 wraps around on unsigned exprs.
This commit is contained in:
parent
0535f8273b
commit
b833f59bb5
@ -80,7 +80,7 @@ void TextDialog::exec() {
|
|||||||
const int fontHeight = gmenu2x->font->getLineSpacing();
|
const int fontHeight = gmenu2x->font->getLineSpacing();
|
||||||
unsigned int contentY, contentHeight;
|
unsigned int contentY, contentHeight;
|
||||||
tie(contentY, contentHeight) = gmenu2x->getContentArea();
|
tie(contentY, contentHeight) = gmenu2x->getContentArea();
|
||||||
const unsigned rowsPerPage = contentHeight / fontHeight;
|
const unsigned rowsPerPage = max(contentHeight / fontHeight, 1u);
|
||||||
const unsigned maxFirstRow =
|
const unsigned maxFirstRow =
|
||||||
text.size() < rowsPerPage ? 0 : text.size() - rowsPerPage;
|
text.size() < rowsPerPage ? 0 : text.size() - rowsPerPage;
|
||||||
contentY += (contentHeight % fontHeight) / 2;
|
contentY += (contentHeight % fontHeight) / 2;
|
||||||
|
@ -92,7 +92,7 @@ void TextManualDialog::exec() {
|
|||||||
ss >> spagecount;
|
ss >> spagecount;
|
||||||
string pageStatus;
|
string pageStatus;
|
||||||
|
|
||||||
const unsigned rowsPerPage = 180 / gmenu2x->font->getLineSpacing();
|
const unsigned rowsPerPage = max(180u / gmenu2x->font->getLineSpacing(), 1u);
|
||||||
|
|
||||||
unsigned page = 0, firstRow = 0;
|
unsigned page = 0, firstRow = 0;
|
||||||
bool close = false;
|
bool close = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user