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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Saiyeux
Copy link

@Saiyeux Saiyeux commented Nov 21, 2022

When an extra long wrapped line is selected, no more \n added to clipboard.

When an extra long wrapped line is selected, no more \n added to clipboard.
Copy link
Contributor

@mike-jumper mike-jumper left a comment

Choose a reason for hiding this comment

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

I'm also unsure what you mean by:

Wrapped lines now clipped into 1.

Can you clarify?


/* 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, -1);
guac_terminal_buffer_row* buffer_row = guac_terminal_buffer_get_row(terminal->buffer, start_row, 0);
guac_terminal_clipboard_append_row(terminal, row, 0, buffer_row->length - 2);
if(!(buffer_row->characters[buffer_row->length - 1].value == 0 && buffer_row->characters[buffer_row->length - 2].value > 0))
Copy link
Contributor

Choose a reason for hiding this comment

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

To match the style of established code, please include a space between if and the opening paren.

@@ -360,16 +360,19 @@ 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 - 2);
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. buffer_row->length is not guaranteed to be at least 2 here unless the call to guac_terminal_buffer_get_row() requests this.
  2. Why are we universally skipping the last two characters?

Copy link
Author

Choose a reason for hiding this comment

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

My purpose it to omit the line break when an extra long line of text is separated because of insufficient length of the terminal simulator. I managed to use buffer_row->length - 1 with server version 1.3.0, but have to cut down another character with 1.4.0. Currently, the horizontal index of bound is length - 2, I'll figure it out with annotations in next commit.

The end param should be length - 1. This logic doesn't clip repeatedly cuz first and end lines are handled separately. Maybe guaca doesn't recognize these long lines when they are broken into different lines in terminal simulator.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants