aboutsummaryrefslogtreecommitdiff
path: root/input_field.c
diff options
context:
space:
mode:
authorJack Jamison <jackqjamison@gmail.com>2025-10-12 00:11:33 -0400
committerJack Jamison <jackqjamison@gmail.com>2025-10-12 00:11:33 -0400
commitd58f2e870b8f998262609b98f91d290b65ab80d3 (patch)
treeacb51286dc7855396e64c228f0fd0a968d41e851 /input_field.c
parent60585faf7951cffb6046280bdd5f91275fb97d65 (diff)
improved key repeat
Diffstat (limited to 'input_field.c')
-rw-r--r--input_field.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/input_field.c b/input_field.c
index 026a22c..114019a 100644
--- a/input_field.c
+++ b/input_field.c
@@ -3,7 +3,7 @@
#include "input_field.h"
#include "array.h"
-void type_key(client_state* state, xkb_keysym_t keysym) {
+bool type_key(client_state* state, xkb_keysym_t keysym) {
bool ctrl = xkb_state_mod_name_is_active(state->xkb_state, XKB_MOD_NAME_CTRL, XKB_STATE_MODS_EFFECTIVE);
// exit app
@@ -12,13 +12,13 @@ void type_key(client_state* state, xkb_keysym_t keysym) {
(keysym == XKB_KEY_Escape)) {
state->running = false;
- return;
+ return false;
}
// submit line
if (keysym == XKB_KEY_Return || keysym == XKB_KEY_KP_Enter) {
submit_line(state);
- return;
+ return false;
}
// delete
@@ -28,7 +28,7 @@ void type_key(client_state* state, xkb_keysym_t keysym) {
} else {
array_pop(state->input_buffer);
}
- return;
+ return true;
}
// type char into buffer
@@ -38,7 +38,10 @@ void type_key(client_state* state, xkb_keysym_t keysym) {
for (int i = 0; i < strlen(buf); i++) {
array_add(state->input_buffer, buf[i]);
}
+ return true;
}
+
+ return false;
}
void submit_line(client_state* state) {