From 199c8fcfa3917609ced0614c0a258a164d33ec24 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Wed, 24 Oct 2018 02:35:44 +0300 Subject: memview: Repaint bottom bar on hexview updates Since the bottom bar contains information about selected bytes, it must be redrawn --- src/memview.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/memview.c b/src/memview.c index 10dc0bf..48837fa 100644 --- a/src/memview.c +++ b/src/memview.c @@ -497,21 +497,8 @@ repaint_hexview(const struct named_region *named, const bool update) } static void -repaint_dynamic_areas(const bool full_repaint) +repaint_bottom_bar(void) { - const struct named_region *last_active = &ctx.named[ctx.active_region]; - const struct named_region *named = named_region_for_offset(ctx.hexview.offset, true); - - if (named != last_active) { - repaint_top_bar(named); - ctx.last_hexview.scroll = (size_t)~0; // avoid diffing - } - - if (memcmp(&ctx.hexview, &ctx.last_hexview, sizeof(ctx.hexview))) { - repaint_hexview(named, (full_repaint || named != last_active)); - ctx.last_hexview = ctx.hexview; - } - screen_cursor(0, ctx.term.ws.h); screen_print(ESCA CLEAR_LINE); screen_nprintf(ctx.term.ws.w, "%zx", ctx.hexview.offset); @@ -535,6 +522,25 @@ repaint_dynamic_areas(const bool full_repaint) } } +static void +repaint_dynamic_areas(const bool full_repaint) +{ + const struct named_region *last_active = &ctx.named[ctx.active_region]; + const struct named_region *named = named_region_for_offset(ctx.hexview.offset, true); + + if (named != last_active) { + repaint_top_bar(named); + ctx.last_hexview.scroll = (size_t)~0; // avoid diffing + } + + if (memcmp(&ctx.hexview, &ctx.last_hexview, sizeof(ctx.hexview))) { + repaint_hexview(named, (full_repaint || named != last_active)); + ctx.last_hexview = ctx.hexview; + } + + repaint_bottom_bar(); +} + static void repaint(void) { @@ -981,6 +987,7 @@ main(int argc, char *argv[]) if (!FD_ISSET(TERM_FILENO, &set)) { // timeout repaint_hexview(named_region_for_offset(ctx.hexview.offset, false), true); + repaint_bottom_bar(); screen_flush(); continue; } -- cgit v1.2.3