esc and entr handling in command mode

This commit is contained in:
Luka Jankovic 2025-07-02 18:00:40 +02:00
parent 5daf8b9dd3
commit 5eb4437ac4
6 changed files with 66 additions and 14 deletions

View file

@ -38,6 +38,7 @@ void kubo_context_cleanup(struct kubo_context *context) {
void kubo_context_set_state(struct kubo_context *context,
enum kubo_context_state state) {
kubo_char_arr_clear(&context->command);
context->state = state;
switch (context->state) {
@ -65,6 +66,11 @@ Color kubo_context_get_color(enum kubo_context_state state) {
return kubo_context_colors[state];
}
void kubo_context_accept_cmd(struct kubo_context *context) {
printf("accepting cmd %s\n", kubo_char_arr_build_str(&context->command));
kubo_context_set_state(context, KUBO_CONTEXT_NORMAL);
}
struct kubo_wall *kubo_context_get_pending_wall(struct kubo_context *context) {
if (context->state != KUBO_CONTEXT_WALL_NEW) {