summaryrefslogtreecommitdiff
path: root/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'command.c')
-rw-r--r--command.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/command.c b/command.c
index beb4d9d..1acca2f 100644
--- a/command.c
+++ b/command.c
@@ -141,9 +141,16 @@ void command_execute(Ted *ted, Command c, i64 argument) {
menu_open(ted, MENU_OPEN);
break;
case CMD_SAVE:
- if (buffer) buffer_save(buffer);
+ if (buffer) {
+ if (buffer->filename && streq(buffer->filename, "Untitled")) {
+ // don't worry, this won't catch files called "Untitled"; buffer->filename is the full path.
+ goto save_as;
+ }
+ buffer_save(buffer);
+ }
break;
case CMD_SAVE_AS:
+ save_as:
if (buffer && !buffer->is_line_buffer) {
menu_open(ted, MENU_SAVE_AS);
}