You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@guacamole.apache.org by "necouchman (via GitHub)" <gi...@apache.org> on 2024/07/30 13:43:30 UTC
Re: [PR] GUACAMOLE-1586: Don't add \n in clipboard if the line isn't finished. [guacamole-server]
necouchman commented on code in PR #512:
URL: https://github.com/apache/guacamole-server/pull/512#discussion_r1696955807
##########
src/terminal/select.c:
##########
@@ -371,17 +371,31 @@ void guac_terminal_select_end(guac_terminal* terminal) {
/* Otherwise, copy multiple rows */
else {
+ /* Get last char of the row */
+ guac_terminal_buffer_row* buffer_row = guac_terminal_buffer_get_row(terminal->buffer, start_row, 0);
+
/* Store first row */
guac_terminal_clipboard_append_row(terminal, start_row, start_col, -1);
/* Store all middle rows */
for (int row = start_row + 1; row < end_row; row++) {
- guac_common_clipboard_append(terminal->clipboard, "\n", 1);
+
+ /* Add a new line only if the line was not wrapped */
+ if (buffer_row->wrapped_row == false)
+ guac_common_clipboard_append(terminal->clipboard, "\n", 1);
+
+ /* Store middle row */
guac_terminal_clipboard_append_row(terminal, row, 0, -1);
+
+ /* Update to last char of current row */
+ buffer_row = guac_terminal_buffer_get_row(terminal->buffer, row, 0);
Review Comment:
As above, how is this getting the last char of the current row? It seems to be to be getting the first char?
##########
src/terminal/select.c:
##########
@@ -371,17 +371,31 @@ void guac_terminal_select_end(guac_terminal* terminal) {
/* Otherwise, copy multiple rows */
else {
+ /* Get last char of the row */
+ guac_terminal_buffer_row* buffer_row = guac_terminal_buffer_get_row(terminal->buffer, start_row, 0);
Review Comment:
I'm a bit confused by the comment, here - wouldn't this particular call get the _first_ character of the given row (index 0 of the row), not the last char of the row?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org