diff options
Diffstat (limited to 'src/ui/inputwidget.c')
-rw-r--r-- | src/ui/inputwidget.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c index 4f9bd367..018daec8 100644 --- a/src/ui/inputwidget.c +++ b/src/ui/inputwidget.c | |||
@@ -98,7 +98,7 @@ void init_InputWidget(iInputWidget *d, size_t maxLen) { | |||
98 | init_Array(&d->oldText, sizeof(iChar)); | 98 | init_Array(&d->oldText, sizeof(iChar)); |
99 | init_String(&d->hint); | 99 | init_String(&d->hint); |
100 | init_Array(&d->undoStack, sizeof(iInputUndo)); | 100 | init_Array(&d->undoStack, sizeof(iInputUndo)); |
101 | d->font = uiInput_FontId; | 101 | d->font = uiInput_FontId | alwaysVariableFlag_FontId; |
102 | d->cursor = 0; | 102 | d->cursor = 0; |
103 | d->lastCursor = 0; | 103 | d->lastCursor = 0; |
104 | d->inFlags = eatEscape_InputWidgetFlag; | 104 | d->inFlags = eatEscape_InputWidgetFlag; |
@@ -789,11 +789,13 @@ static void draw_InputWidget_(const iInputWidget *d) { | |||
789 | else { | 789 | else { |
790 | initCStr_String(&cur, " "); | 790 | initCStr_String(&cur, " "); |
791 | } | 791 | } |
792 | /* The `gap_UI` offsets below are a hack. They are used because for some reason the | ||
793 | cursor rect and the glyph inside don't quite position like during `run_Text_()`. */ | ||
792 | const iInt2 prefixSize = advanceN_Text(d->font, cstr_String(text), d->cursor); | 794 | const iInt2 prefixSize = advanceN_Text(d->font, cstr_String(text), d->cursor); |
793 | const iInt2 curPos = addX_I2(textOrigin, prefixSize.x); | 795 | const iInt2 curPos = addX_I2(textOrigin, prefixSize.x); |
794 | const iRect curRect = { curPos, addX_I2(advance_Text(d->font, cstr_String(&cur)), 1) }; | 796 | const iRect curRect = { curPos, addX_I2(advance_Text(d->font, cstr_String(&cur)), iMin(2, gap_UI / 4)) }; |
795 | fillRect_Paint(&p, curRect, uiInputCursor_ColorId); | 797 | fillRect_Paint(&p, curRect, uiInputCursor_ColorId); |
796 | draw_Text(d->font, curPos, uiInputCursorText_ColorId, "%s", cstr_String(&cur)); | 798 | draw_Text(d->font, addX_I2(curPos, iMin(1, gap_UI / 8)), uiInputCursorText_ColorId, "%s", cstr_String(&cur)); |
797 | deinit_String(&cur); | 799 | deinit_String(&cur); |
798 | } | 800 | } |
799 | delete_String(text); | 801 | delete_String(text); |