about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--100trace_browser.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/100trace_browser.cc b/100trace_browser.cc
index 7d62fe14..90fc1287 100644
--- a/100trace_browser.cc
+++ b/100trace_browser.cc
@@ -115,10 +115,14 @@ void start_trace_browser() {
     else if (key == 'c') {
       // move cursor to center of screen
       Display_row = tb_height()/2;
+      while (!contains_key(Trace_index, Display_row))
+        --Display_row;
     }
     else if (key == 'b') {
       // move cursor to bottom of screen
       Display_row = tb_height()-1;
+      while (!contains_key(Trace_index, Display_row))
+        --Display_row;
     }
     else if (key == 'T') {
       // scroll line at cursor to top of screen