GUACAMOLE-1682: Merge automatic newline normalization of terminal clipboard.

This commit is contained in:
Mike Jumper 2022-10-18 12:41:48 -07:00 committed by GitHub
commit 067f2a91a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,6 +20,7 @@
#include "common/clipboard.h" #include "common/clipboard.h"
#include "common/cursor.h" #include "common/cursor.h"
#include "common/iconv.h"
#include "terminal/buffer.h" #include "terminal/buffer.h"
#include "terminal/color-scheme.h" #include "terminal/color-scheme.h"
#include "terminal/common.h" #include "terminal/common.h"
@ -2165,7 +2166,16 @@ void guac_terminal_clipboard_reset(guac_terminal* terminal,
void guac_terminal_clipboard_append(guac_terminal* terminal, void guac_terminal_clipboard_append(guac_terminal* terminal,
const char* data, int length) { const char* data, int length) {
guac_common_clipboard_append(terminal->clipboard, data, length);
/* Allocate and clear space for the converted data */
char output_data[GUAC_COMMON_CLIPBOARD_MAX_LENGTH];
char* output = output_data;
/* Convert clipboard contents */
guac_iconv(GUAC_READ_UTF8_NORMALIZED, &data, length,
GUAC_WRITE_UTF8, &output, GUAC_COMMON_CLIPBOARD_MAX_LENGTH);
guac_common_clipboard_append(terminal->clipboard, output_data, output - output_data);
} }
void guac_terminal_remove_user(guac_terminal* terminal, guac_user* user) { void guac_terminal_remove_user(guac_terminal* terminal, guac_user* user) {