summaryrefslogtreecommitdiff
path: root/src/ui.c
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrik.ramaekers@protonmail.com>2020-02-06 19:54:20 +0100
committerAldrik Ramaekers <aldrik.ramaekers@protonmail.com>2020-02-06 19:54:20 +0100
commit4c4c128faca10d54af6da25891b2fbbb2b8444e6 (patch)
tree8d2e5315763a97987f847e4fab6fc5f7f90790ec /src/ui.c
parent0064bb8b06ee74750ee21274b1e48ff1378d220e (diff)
automated sync
Diffstat (limited to 'src/ui.c')
-rw-r--r--src/ui.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ui.c b/src/ui.c
index 68807fd..a8242cd 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -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;