diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2021-03-06 13:57:12 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2021-03-06 13:57:12 -0500 |
commit | 88946161165f62b955c3c25b7d6760b77fac42c6 (patch) | |
tree | 3c62433d532fc59d617fe7b1eb1358a11e16f3a8 /ui.c | |
parent | 87fe34bdbaa2d840d5d4e988ffd789eb3e7a039a (diff) |
fix "save as" menu
Diffstat (limited to 'ui.c')
-rw-r--r-- | ui.c | 32 |
1 files changed, 15 insertions, 17 deletions
@@ -374,25 +374,23 @@ static char *file_selector_update(Ted *ted, FileSelector *fs) { strbuf_printf(path, "%s%s%s", cwd, cwd[strlen(cwd)-1] == PATH_SEPARATOR ? "" : PATH_SEPARATOR_STR, option_chosen); char *ret = NULL; - if (fs->create_menu) { - // don't need to check anything + switch (fs_path_type(path)) { + case FS_NON_EXISTENT: + case FS_OTHER: + if (fs->create_menu) + ret = str_dup(path); // you can only select non-existent things if this is a create menu + break; + case FS_FILE: + // selected a file! ret = str_dup(path); - } else { - switch (fs_path_type(path)) { - case FS_NON_EXISTENT: break; - case FS_OTHER: break; - - case FS_FILE: - // selected a file! - ret = str_dup(path); - break; - case FS_DIRECTORY: - // cd there - file_selector_cd(ted, fs, option_chosen); - buffer_clear(line_buffer); - break; - } + break; + case FS_DIRECTORY: + // cd there + file_selector_cd(ted, fs, option_chosen); + buffer_clear(line_buffer); + break; } + free(option_chosen); if (ret) { return ret; |