-
Notifications
You must be signed in to change notification settings - Fork 641
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: Don't add \n in clipboard if the line isn't finished. #512
GUACAMOLE-1586: Don't add \n in clipboard if the line isn't finished. #512
Conversation
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 wondering if this entire section, including the if
statement immediately above here, could be simplified to something like this:
guac_terminal_select_normalized_range(terminal, &start_row, &start_col, &end_row, &end_col);
int row = start_row;
do {
// Copy the current row.
guac_terminal_clipboard_append_row(terminal, row, start_col, end_col);
guac_terminal_buffer_row* buffer_row = guac_terminal_buffer_get_row(terminal->buffer, row, 0);
int last_char = buffer_row->characters[terminal->term_width - 1].value;
if (last_char == 0)
guac_common_clipboard_append(terminal->clipboard, "\n", 1);
// Increment row
row++;
}
while (row <= end_row);
?
I haven't actually tested that block of code, but it works in my head :-). I'm not sure if there's some reason that the code needs the extra if...else
blocks, plus the loop? Maybe there are some corner cases that don't work - like if the last line does or does not end with a line break??
a6a8a3d
to
e70159a
Compare
I've reworked this PR, it's ready for review! |
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.
@corentin-soriano The changes look good to me, although @mike-jumper and @jmuehlner are more familiar with the terminal implementation, so I'm curious if either of them has any feedback on it.
My only other request is to rebase this against the patch
branch, as I think this is more of a bug fix than a feature implementation - having a stray newline added to the clipboard when it is not part of the actual text your copying seems like a (minor) bug.
e70159a
to
5da2d4a
Compare
Rebased from patch branch. |
Just passing here to thank you @corentin-soriano for this contribution and also for the work on Guacamole-192. |
40b09a6
to
d7de57d
Compare
d7de57d
to
63abf5d
Compare
108b787
to
1521094
Compare
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 have just a couple of minor concerns about a couple of the comments.
1521094
to
119f969
Compare
@necouchman Is this merge going to be included on 1.6.0 release? I think that would be great |
@necouchman, @jmuehlner, have you any other comments on this PR? |
It's looking pretty good to me - though I do wonder if it should be targeted at 1.6.0 - it is a bug fix, afterall. |
Agreed - @corentin-soriano, if you could rebase against |
Thank you for your feedback! |
In the case of selecting multiple lines, do not add \n if the line is not really finished.
Changes: