summaryrefslogtreecommitdiff
path: root/command.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-08-27 19:30:07 -0400
committerpommicket <pommicket@gmail.com>2023-08-27 19:30:07 -0400
commit8cfcfb6309c0399c3e5e491695086d4723bfbc72 (patch)
tree3e5b60381abae2fb3704ce37e34d8e1ca85cf096 /command.c
parentf999900e3a1cf54b57fe051f248dae56f31f8b7c (diff)
disambiguate between files with the same name
Diffstat (limited to 'command.c')
-rw-r--r--command.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/command.c b/command.c
index b6b5324..07d3856 100644
--- a/command.c
+++ b/command.c
@@ -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);