Skip to content

Commit e7a20ef

Browse files
committed
Fix text truncation
1 parent a25f59b commit e7a20ef

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

armorcore/sources/iron_ui.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,14 +308,15 @@ ui_text_extract_t ui_extract_coloring(char *text, ui_coloring_t *col) {
308308

309309
void ui_draw_string(char *text, float x_offset, float y_offset, int align, bool truncation) {
310310
static char temp[1024];
311+
static char truncated[1024];
311312
if (text == NULL) {
312313
return;
313314
}
314315
if (truncation) {
315316
assert(strlen(text) < 1024 - 2);
316317
char *full_text = text;
317-
strcpy(temp, text);
318-
text = &temp[0];
318+
strcpy(truncated, text);
319+
text = &truncated[0];
319320
while (strlen(text) > 0 && arm_g2_string_width(current->ops->font->font_, current->font_size, text) > current->_w - 6.0 * UI_SCALE()) {
320321
text[strlen(text) - 1] = 0;
321322
}

0 commit comments

Comments
 (0)