about summary refs log tree commit diff stats
path: root/077trace_browser.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-05-28 18:11:28 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-05-28 18:11:28 -0700
commit63030ea7e4f4dc92d37adf7a721fc63679f2be0a (patch)
tree4c4e001e29c2d800b0fb696b43039788d60834a9 /077trace_browser.cc
parent8183efcf1e70cd98297189b28aadf83148caa1b1 (diff)
downloadmu-63030ea7e4f4dc92d37adf7a721fc63679f2be0a.tar.gz
1509
Ah, the failing test isn't what I thought. This is a regression.
Let's debug this using the trace-browser! Little tweak as I use it.
Diffstat (limited to '077trace_browser.cc')
-rw-r--r--077trace_browser.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/077trace_browser.cc b/077trace_browser.cc
index 024e5e63..6819a473 100644
--- a/077trace_browser.cc
+++ b/077trace_browser.cc
@@ -71,10 +71,9 @@ void start_trace_browser() {
     }
     if (key == 'K') {
       // page-up is more convoluted
-      int max = tb_height();
 //?       tb_shutdown(); //? 1
 //?       cerr << "page-up: Top_of_screen is currently " << Top_of_screen << '\n'; //? 1
-      for (int screen_row = max; screen_row > 0 && Top_of_screen > 0; --screen_row) {
+      for (int screen_row = tb_height(); screen_row > 0 && Top_of_screen > 0; --screen_row) {
         --Top_of_screen;
         if (Top_of_screen <= 0) break;
         while (Top_of_screen > 0 && Visible.find(Top_of_screen) == Visible.end())
@@ -85,6 +84,20 @@ void start_trace_browser() {
       if (Top_of_screen > 0)
         refresh_screen_rows();
     }
+    if (key == 'G') {
+      // go to bottom of screen; largely like page-up, interestingly
+      Top_of_screen = SIZE(Trace_stream->past_lines)-1;
+      for (int screen_row = tb_height(); screen_row > 0 && Top_of_screen > 0; --screen_row) {
+        --Top_of_screen;
+        if (Top_of_screen <= 0) break;
+        while (Top_of_screen > 0 && Visible.find(Top_of_screen) == Visible.end())
+          --Top_of_screen;
+      }
+      refresh_screen_rows();
+      // move cursor to bottom
+      Display_row = Last_printed_row;
+      refresh_screen_rows();
+    }
     if (key == TB_KEY_CARRIAGE_RETURN) {
       // expand lines under current by one level
 //?       tb_shutdown();