mike-jumper commented on a change in pull request #237: GUACAMOLE-871: Add 
support for hidden cursor (DECTECM)
URL: https://github.com/apache/guacamole-server/pull/237#discussion_r334691312
 
 

 ##########
 File path: src/terminal/terminal.c
 ##########
 @@ -777,31 +778,43 @@ void guac_terminal_commit_cursor(guac_terminal* term) {
 
     guac_terminal_char* guac_char;
 
-    guac_terminal_buffer_row* old_row;
-    guac_terminal_buffer_row* new_row;
+    guac_terminal_buffer_row* row;
 
     /* If no change, done */
     if (term->visible_cursor_row == term->cursor_row && 
term->visible_cursor_col == term->cursor_col)
         return;
 
-    /* Get old and new rows with cursor */
-    new_row = guac_terminal_buffer_get_row(term->buffer, term->cursor_row, 
term->cursor_col+1);
-    old_row = guac_terminal_buffer_get_row(term->buffer, 
term->visible_cursor_row, term->visible_cursor_col+1);
-
     /* Clear cursor */
-    guac_char = &(old_row->characters[term->visible_cursor_col]);
-    guac_char->attributes.cursor = false;
-    guac_terminal_display_set_columns(term->display, term->visible_cursor_row 
+ term->scroll_offset,
-            term->visible_cursor_col, term->visible_cursor_col, guac_char);
+    if (term->visible_cursor_row != -1 && term->visible_cursor_col != -1)
+    {
+        /* Get old row with cursor */
+        row = guac_terminal_buffer_get_row(term->buffer, 
term->visible_cursor_row, term->visible_cursor_col+1);
+
+        guac_char = &(row->characters[term->visible_cursor_col]);
+        guac_char->attributes.cursor = false;
+        guac_terminal_display_set_columns(term->display, 
term->visible_cursor_row + term->scroll_offset,
+                term->visible_cursor_col, term->visible_cursor_col, guac_char);
+    }
 
 Review comment:
   Here and elsewhere, please use the same style as the surrounding code. Where 
braces are used for `if`, `else`, etc., we have the opening brace on the same 
line. Instead of:
   
   ```c
   if (foo)
   {
   }
   else
   {
   }
   ```
   
   You'll find:
   
   ```c
   if (foo) {
   }
   else {
   }
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to