perf ui: Make END go to the last entry, not the top of the last page
authorArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 15 Jul 2010 10:21:07 +0000 (07:21 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Sat, 17 Jul 2010 18:44:43 +0000 (15:44 -0300)
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/newt.c

index 06f248fde5cf89b7f3b4b2858261a9e5e500b4ad..932f12468c3c78c73aa080ddd7adf79f348c83aa 100644 (file)
@@ -491,11 +491,11 @@ static int ui_browser__run(struct ui_browser *self, struct newtExitStruct *es)
                        break;
                case NEWT_KEY_END:
                        offset = self->height - 1;
+                       if (offset >= self->nr_entries)
+                               offset = self->nr_entries - 1;
 
-                       if (offset > self->nr_entries)
-                               offset = self->nr_entries;
-
-                       self->index = self->first_visible_entry_idx = self->nr_entries - 1 - offset;
+                       self->index = self->nr_entries - 1;
+                       self->first_visible_entry_idx = self->index - offset;
                        self->seek(self, -offset, SEEK_END);
                        break;
                case NEWT_KEY_RIGHT: