summaryrefslogtreecommitdiff
path: root/command.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-01-29 17:51:49 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-01-29 17:51:49 -0500
commita0b84cc8f40e19a506332be3a05222b87e6ed617 (patch)
tree68607facee3bb655cfe2166d4a578db9e91bdf1f /command.c
parent565b5e619ed64f459f1b38b5b94bb72b5b9a714f (diff)
better tab bar, default to "save as" on Ctrl+S with starting buffer
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);
}