summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2018-10-24 02:35:44 +0300
committerJari Vetoniemi <mailroxas@gmail.com>2018-10-24 02:35:44 +0300
commit199c8fcfa3917609ced0614c0a258a164d33ec24 (patch)
tree589dd1384361aa5b502853a2865677fe8d8e47f2
parentf88ac1e80061c30b3b34dc854768b9b44fc472f6 (diff)
memview: Repaint bottom bar on hexview updates
Since the bottom bar contains information about selected bytes, it must be redrawn
-rw-r--r--src/memview.c35
1 files changed, 21 insertions, 14 deletions
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);
@@ -536,6 +523,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)
{
ctx.last_hexview.scroll = (size_t)~0; // avoid diffing
@@ -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;
}