summaryrefslogtreecommitdiff
path: root/menu.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-03-23 13:55:50 -0400
committerpommicket <pommicket@gmail.com>2023-03-23 13:55:50 -0400
commiteb088ebd059ba00735723fb394d3bfe1b3530026 (patch)
treed7bfedce0a1f859ba89525afe1ae6a1afce427ae /menu.c
parent63f54d13aa7233986f784ef857faef259a889ed6 (diff)
get rid of ARG_STRING, start macros
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/menu.c b/menu.c
index b894c35..5a65ea4 100644
--- a/menu.c
+++ b/menu.c
@@ -289,9 +289,15 @@ void menu_update(Ted *ted) {
Command c = command_from_str(chosen_command);
if (c != CMD_UNKNOWN) {
char *argument = str32_to_utf8_cstr(buffer_get_line(&ted->argument_buffer, 0)), *endp = NULL;
- long long arg = strtoll(argument, &endp, 0);
-
- if (*endp == '\0') {
+ long long arg = 1;
+ bool execute = true;
+ if (*argument) {
+ strtoll(argument, &endp, 0);
+ if (*endp != '\0')
+ execute = false;
+ }
+
+ if (execute) {
menu_close(ted);
command_execute(ted, c, arg);
}