file-browser: elide trailing line feed when copying files

This commit is contained in:
K. Lange 2018-11-18 19:42:31 +09:00
parent b5c9b39f91
commit 0741d625c9

View File

@ -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);
}