summaryrefslogtreecommitdiff
path: root/textscreen/txt_inputbox.c
diff options
context:
space:
mode:
Diffstat (limited to 'textscreen/txt_inputbox.c')
-rw-r--r--textscreen/txt_inputbox.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/textscreen/txt_inputbox.c b/textscreen/txt_inputbox.c
index 0f2986cc..da872c9c 100644
--- a/textscreen/txt_inputbox.c
+++ b/textscreen/txt_inputbox.c
@@ -139,9 +139,21 @@ static void TXT_InputBoxDrawer(TXT_UNCAST_ARG(inputbox))
SetBufferFromValue(inputbox);
}
- TXT_DrawUTF8String(inputbox->buffer);
+ // If string size exceeds the widget's width, show only the end.
- chars = TXT_UTF8_Strlen(inputbox->buffer);
+ if (TXT_UTF8_Strlen(inputbox->buffer) > w - 1)
+ {
+ TXT_DrawString("\xae");
+ TXT_DrawUTF8String(
+ TXT_UTF8_SkipChars(inputbox->buffer,
+ TXT_UTF8_Strlen(inputbox->buffer) - w + 2));
+ chars = w - 1;
+ }
+ else
+ {
+ TXT_DrawUTF8String(inputbox->buffer);
+ chars = TXT_UTF8_Strlen(inputbox->buffer);
+ }
if (chars < w && inputbox->editing && focused)
{