Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUACAMOLE-1586: Wrapped lines now clipped into 1. #402

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/terminal/select.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,16 +360,23 @@ void guac_terminal_select_end(guac_terminal* terminal) {
else {

/* Store first row */
guac_terminal_clipboard_append_row(terminal, start_row, start_col, -1);
guac_terminal_buffer_row* buffer_row = guac_terminal_buffer_get_row(terminal->buffer, start_row, 0);
guac_terminal_clipboard_append_row(terminal, start_row, start_col, buffer_row->length - 1);

/* Store all middle rows */
for (int row = start_row + 1; row < end_row; row++) {
guac_common_clipboard_append(terminal->clipboard, "\n", 1);
guac_terminal_clipboard_append_row(terminal, row, 0, -1);
guac_terminal_buffer_row* buffer_row = guac_terminal_buffer_get_row(terminal->buffer, start_row, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this repeatedly retrieve the same row?

guac_terminal_clipboard_append_row(terminal, row, 0, buffer_row->length - 1);

/* If line breaks, add break sign */
if (!(buffer_row->characters[buffer_row->length - 1].value == 0 && buffer_row->characters[buffer_row->length - 2].value > 0))
guac_common_clipboard_append(terminal->clipboard, "\n", 1);

/* If no spaces visible at the boundary, this line may got broken due to insufficient terminal length, no "\n" added */

}

/* Store last row */
guac_common_clipboard_append(terminal->clipboard, "\n", 1);
guac_terminal_clipboard_append_row(terminal, end_row, 0, end_col);

}
Expand Down