summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-07-25 12:43:20 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-07-25 12:43:20 +0300
commitd5c80c506389683c4bab5c26e369fd186d88a242 (patch)
treeadfa97caddfff0b66888a95e8a1c6e8b78a83d87 /src
parent79bb296310755eb791dde7302edea214b9ecf878 (diff)
InputWidget: Long text may disappear
Diffstat (limited to 'src')
-rw-r--r--src/ui/inputwidget.c3
-rw-r--r--src/ui/text.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c
index 3b60fc45..6c05dbd1 100644
--- a/src/ui/inputwidget.c
+++ b/src/ui/inputwidget.c
@@ -309,8 +309,7 @@ static void draw_InputWidget_(const iInputWidget *d) {
309 } 309 }
310 const int yOff = (height_Rect(bounds) - lineHeight_Text(d->font)) / 2; 310 const int yOff = (height_Rect(bounds) - lineHeight_Text(d->font)) / 2;
311 draw_Text(d->font, 311 draw_Text(d->font,
312 add_I2(topLeft_Rect(bounds), 312 add_I2(topLeft_Rect(bounds), init_I2(xOff, yOff)),
313 init_I2(xOff, yOff)),
314 white_ColorId, 313 white_ColorId,
315 "%s", 314 "%s",
316 cstr_String(&text)); 315 cstr_String(&text));
diff --git a/src/ui/text.c b/src/ui/text.c
index 6c3d78a1..dd8b4323 100644
--- a/src/ui/text.c
+++ b/src/ui/text.c
@@ -582,6 +582,8 @@ void draw_Text(int fontId, iInt2 pos, int color, const char *text, ...) {
582 vprintf_Block(&chars, text, args); 582 vprintf_Block(&chars, text, args);
583 va_end(args); 583 va_end(args);
584 } 584 }
585#if 0
586 /* BUG: A long text string may have a negative X but still be meant to the left-aligned. */
585 if (pos.x < 0) { 587 if (pos.x < 0) {
586 /* Right-aligned. */ 588 /* Right-aligned. */
587 pos.x = -pos.x - measure_Text(fontId, cstr_Block(&chars)).x; 589 pos.x = -pos.x - measure_Text(fontId, cstr_Block(&chars)).x;
@@ -590,6 +592,7 @@ void draw_Text(int fontId, iInt2 pos, int color, const char *text, ...) {
590 /* Bottom-aligned. */ 592 /* Bottom-aligned. */
591 pos.y = -pos.y - lineHeight_Text(fontId); 593 pos.y = -pos.y - lineHeight_Text(fontId);
592 } 594 }
595#endif
593 draw_Text_(fontId, pos, color, (iRangecc){ constBegin_Block(&chars), constEnd_Block(&chars) }); 596 draw_Text_(fontId, pos, color, (iRangecc){ constBegin_Block(&chars), constEnd_Block(&chars) });
594 deinit_Block(&chars); 597 deinit_Block(&chars);
595} 598}