Skip to content

Commit

Permalink
Merge pull request #164 from marekmaskarinec/marek/textbox-fix
Browse files Browse the repository at this point in the history
Sanitize control characters in input str (#144)
  • Loading branch information
ske2004 authored Mar 11, 2024
2 parents 0d814e1 + 77f0a66 commit d260d2c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/umka
3 changes: 3 additions & 0 deletions src/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ event(const sapp_event *ev)
thg->mouse = (th_vf2){.x = ev->mouse_x, .y = ev->mouse_y};
break;
case SAPP_EVENTTYPE_CHAR:
if (ev->char_code < ' ' || ev->char_code == 127 /* DEL character */)
break;

thg->input_string_len = th_utf8_encode(thg->input_string, ev->char_code);
break;
case SAPP_EVENTTYPE_KEY_DOWN:
Expand Down

0 comments on commit d260d2c

Please sign in to comment.