diff options
| author | Aldrik Ramaekers <aldrik.ramaekers@protonmail.com> | 2020-02-06 19:54:20 +0100 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrik.ramaekers@protonmail.com> | 2020-02-06 19:54:20 +0100 |
| commit | 4c4c128faca10d54af6da25891b2fbbb2b8444e6 (patch) | |
| tree | 8d2e5315763a97987f847e4fab6fc5f7f90790ec /src/ui.c | |
| parent | 0064bb8b06ee74750ee21274b1e48ff1378d220e (diff) | |
automated sync
Diffstat (limited to 'src/ui.c')
| -rw-r--r-- | src/ui.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -52,6 +52,7 @@ inline textbox_state ui_create_textbox(u16 max_len) state.last_click_cursor_index = -1; state.attempting_to_select = false; state.deselect_on_enter = true; + state.accept_newline = false; return state; } @@ -654,6 +655,12 @@ bool ui_push_textbox(textbox_state *state, char *placeholder) global_ui_context.keyboard->has_selection = false; state->state = false; } + if (state->state && keyboard_is_key_down(global_ui_context.keyboard, KEY_LEFT_CONTROL) && + keyboard_is_key_pressed(global_ui_context.keyboard, KEY_ENTER) && + state->accept_newline) + { + keyboard_handle_input_string(global_ui_context.layout.active_window, global_ui_context.keyboard, "\n"); + } // calculate scissor rectangle if (global_ui_context.layout.scroll->in_scroll) @@ -763,6 +770,7 @@ bool ui_push_textbox(textbox_state *state, char *placeholder) } string_copyn(state->buffer, global_ui_context.keyboard->input_text, state->max_len); + if (global_ui_context.keyboard->cursor > state->max_len) { global_ui_context.keyboard->cursor = state->max_len; |
