[ghex] gtkhex: fix calculation of offset cols required



commit ec6e0d78e212f848ad50b9cb9b7df7272a9bba73
Author: Logan Rathbone <poprocks gmail com>
Date:   Sat Dec 25 15:13:52 2021 -0500

    gtkhex: fix calculation of offset cols required
    
    See #41
    
    This reveals a bug that causes the layout manager to get "caught"
    between 2 different sizes if you jump to e.g. 0xffffffff in a >= 4gb
    file. But that is a separate issue.

 src/gtkhex.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/gtkhex.c b/src/gtkhex.c
index a1b3d1b..2ff3663 100644
--- a/src/gtkhex.c
+++ b/src/gtkhex.c
@@ -1097,7 +1097,7 @@ render_offsets (GtkHex *gh,
         * how many chars will be in the last offset marker of the screen */
        
        snprintf (buf, BUFLEN-1, "%lX",
-                       MAX ((gh->top_line + max_lines - 1), 0) * gh->cpl);
+                       MAX ((gh->top_line + max_lines), 0) * gh->cpl);
        off_cpl = MAX (MIN_CPL, strlen (buf));
        snprintf (fmt, BUFLEN-1, "%%0%dlX", off_cpl); 
        gtk_hex_layout_set_offset_cpl (GTK_HEX_LAYOUT(gh->layout_manager), off_cpl);


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