From d5c80c506389683c4bab5c26e369fd186d88a242 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Sat, 25 Jul 2020 12:43:20 +0300 Subject: InputWidget: Long text may disappear --- src/ui/inputwidget.c | 3 +-- src/ui/text.c | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src/ui') 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) { } const int yOff = (height_Rect(bounds) - lineHeight_Text(d->font)) / 2; draw_Text(d->font, - add_I2(topLeft_Rect(bounds), - init_I2(xOff, yOff)), + add_I2(topLeft_Rect(bounds), init_I2(xOff, yOff)), white_ColorId, "%s", 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, ...) { vprintf_Block(&chars, text, args); va_end(args); } +#if 0 + /* BUG: A long text string may have a negative X but still be meant to the left-aligned. */ if (pos.x < 0) { /* Right-aligned. */ 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, ...) { /* Bottom-aligned. */ pos.y = -pos.y - lineHeight_Text(fontId); } +#endif draw_Text_(fontId, pos, color, (iRangecc){ constBegin_Block(&chars), constEnd_Block(&chars) }); deinit_Block(&chars); } -- cgit v1.2.3