diff --git a/apps/file-browser.c b/apps/file-browser.c index eb72a212..cb873b32 100644 --- a/apps/file-browser.c +++ b/apps/file-browser.c @@ -404,6 +404,8 @@ static void _menu_action_copy(struct MenuEntry * entry) { } } + if (!output_size) return; + char * clipboard = malloc(output_size); clipboard[0] = '\0'; for (int i = 0; i < file_pointers_len; ++i) { @@ -415,6 +417,11 @@ static void _menu_action_copy(struct MenuEntry * entry) { } } + if (clipboard[output_size-1] == '\n') { + /* Remove trailing line feed */ + clipboard[output_size-1] = '\0'; + } + yutani_set_clipboard(yctx, clipboard); free(clipboard); }