чување 82d0b6a2666b2266c28ee4d3b1118128c3e48063
родитељ a3e96a3b779237982b8f9a7a0cdd460c1bd71a28
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Fri, 14 Jun 2024 22:21:04 +0200
Make y/n prompts case-insensitive
Diffstat:
измењених датотека: 2, додавања: 3(+), брисања: 3(-)
diff --git a/TODO b/TODO
@@ -1,7 +1,7 @@
TODO
====
-[ ] Make y/n prompts case-insensitive
+[x] Make y/n prompts case-insensitive
< > Make allocation errors prompt to save the file before exiting?
- Would this make sense?
diff --git a/sled.c b/sled.c
@@ -475,7 +475,7 @@ handle_key_event(struct tb_event* ev, struct DrawState* state)
if (IN(state->mode, M_PROMPT))
{
- if (ev->ch == 'y' || ev->ch == 'n')
+ if (strchr("YyNn", ev->ch))
{
if (state->prompt_callback)
state->prompt_callback(state, ev);
@@ -991,7 +991,7 @@ reread_callback(struct DrawState* state, struct tb_event* ev)
if (!state)
return;
- if (ev->ch == 'y')
+ if (strchr("Yy", ev->ch))
reread_file(state);
state->prompt_callback = NULL;
}