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
base: main
Are you sure you want to change the base?
Conversation
When an extra long wrapped line is selected, no more \n added to clipboard.
There was a problem hiding this 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); |
There was a problem hiding this comment.
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?
src/terminal/select.c
Outdated
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)) |
There was a problem hiding this comment.
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.
src/terminal/select.c
Outdated
@@ -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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
buffer_row->length
is not guaranteed to be at least 2 here unless the call toguac_terminal_buffer_get_row()
requests this.- Why are we universally skipping the last two characters?
There was a problem hiding this comment.
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.
When an extra long wrapped line is selected, no more \n added to clipboard.