summaryrefslogtreecommitdiff
path: root/menu.c
diff options
context:
space:
mode:
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);
}