[ghex] gtkhex: Fix an odd regression re cursor redraw



commit 49194840f6c4ddfe18b61a5bbc52a5daec0c8612
Author: Logan Rathbone <poprocks gmail com>
Date:   Mon Dec 20 21:02:07 2021 -0500

    gtkhex: Fix an odd regression re cursor redraw
    
    Note to self: stop coding at 4am.

 src/gtkhex.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/src/gtkhex.c b/src/gtkhex.c
index 3b200ce..42f357c 100644
--- a/src/gtkhex.c
+++ b/src/gtkhex.c
@@ -509,7 +509,7 @@ get_xcoords (GtkHex *gh, gint64 pos, int *x, int *y)
        /* nb: Having this as an assertion warning is annoying. Happens a lot
         * in that case if you scroll way up/down in a big file and suddenly start
         * dragging. */
-       if (cx + spaces < INT_MAX && cy < INT_MAX)
+       if (cx + spaces > INT_MAX && cy > INT_MAX)
                return FALSE;
 
        *x = cx + spaces;
@@ -538,7 +538,7 @@ get_acoords (GtkHex *gh, gint64 pos, int *x, int *y)
        /* nb: Having this as an assertion warning is annoying. Happens a lot
         * in that case if you scroll way up/down in a big file and suddenly start
         * dragging. */
-       if (cy < INT_MAX && cx < INT_MAX)
+       if (cy > INT_MAX && cx > INT_MAX)
                return FALSE;
 
        *x = cx;
@@ -550,28 +550,28 @@ get_acoords (GtkHex *gh, gint64 pos, int *x, int *y)
 static void
 invalidate_xc (GtkHex *gh)
 {
-    GtkWidget *widget = gh->xdisp;
-    int cx, cy;
+       GtkWidget *widget = gh->xdisp;
+       int cx, cy;
 
-    if (get_xcoords (gh, gh->cursor_pos, &cx, &cy))
+       if (get_xcoords (gh, gh->cursor_pos, &cx, &cy))
        {
-        if (gh->lower_nibble)
-            cx += gh->char_width;
+               if (gh->lower_nibble)
+                       cx += gh->char_width;
 
                gtk_widget_queue_draw (widget);
-    }
+       }
 }
 
 static void
 invalidate_ac (GtkHex *gh)
 {
-    GtkWidget *widget = gh->adisp;
-    int cx, cy;
+       GtkWidget *widget = gh->adisp;
+       int cx, cy;
 
-    if (get_acoords (gh, gh->cursor_pos, &cx, &cy))
+       if (get_acoords (gh, gh->cursor_pos, &cx, &cy))
        {
                gtk_widget_queue_draw (widget);
-    }
+       }
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]