diff options
author | pommicket <pommicket@gmail.com> | 2023-08-27 19:30:07 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-08-27 19:30:07 -0400 |
commit | 8cfcfb6309c0399c3e5e491695086d4723bfbc72 (patch) | |
tree | 3e5b60381abae2fb3704ce37e34d8e1ca85cf096 /command.c | |
parent | f999900e3a1cf54b57fe051f248dae56f31f8b7c (diff) |
disambiguate between files with the same name
Diffstat (limited to 'command.c')
-rw-r--r-- | command.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -452,8 +452,9 @@ void command_execute_ex(Ted *ted, Command c, const CommandArgument *full_argumen arr_foreach_ptr(ted->buffers, TextBufferPtr, pbuffer) { buffer = *pbuffer; if (buffer_unsaved_changes(buffer)) { - const char *path = buffer_display_filename(buffer); - strbuf_catf(ted->warn_unsaved_names, "%s%s", first ? "" : ", ", path); + char name[TED_PATH_MAX]; + buffer_display_filename(buffer, name, sizeof name); + strbuf_catf(ted->warn_unsaved_names, "%s%s", first ? "" : ", ", name); first = false; } } @@ -579,7 +580,7 @@ void command_execute_ex(Ted *ted, Command c, const CommandArgument *full_argumen if (argument != 2 && buffer_unsaved_changes(buffer)) { // there are unsaved changes! ted->warn_unsaved = CMD_TAB_CLOSE; - strbuf_printf(ted->warn_unsaved_names, "%s", buffer_display_filename(buffer)); + buffer_display_filename(buffer, ted->warn_unsaved_names, sizeof ted->warn_unsaved_names); menu_open(ted, MENU_WARN_UNSAVED); } else { node_tab_close(ted, node, tab_idx); |