diff options
Diffstat (limited to 'tools/perf/util/newt.c')
-rw-r--r-- | tools/perf/util/newt.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c index cf182ca132fe..1e774e7f2281 100644 --- a/tools/perf/util/newt.c +++ b/tools/perf/util/newt.c | |||
@@ -270,6 +270,11 @@ struct ui_browser { | |||
270 | u32 nr_entries; | 270 | u32 nr_entries; |
271 | }; | 271 | }; |
272 | 272 | ||
273 | static bool ui_browser__is_current_entry(struct ui_browser *self, unsigned row) | ||
274 | { | ||
275 | return (self->first_visible_entry_idx + row) == self->index; | ||
276 | } | ||
277 | |||
273 | static void ui_browser__refresh_dimensions(struct ui_browser *self) | 278 | static void ui_browser__refresh_dimensions(struct ui_browser *self) |
274 | { | 279 | { |
275 | int cols, rows; | 280 | int cols, rows; |
@@ -286,8 +291,8 @@ static void ui_browser__refresh_dimensions(struct ui_browser *self) | |||
286 | 291 | ||
287 | static void ui_browser__reset_index(struct ui_browser *self) | 292 | static void ui_browser__reset_index(struct ui_browser *self) |
288 | { | 293 | { |
289 | self->index = self->first_visible_entry_idx = 0; | 294 | self->index = self->first_visible_entry_idx = 0; |
290 | self->first_visible_entry = NULL; | 295 | self->first_visible_entry = NULL; |
291 | } | 296 | } |
292 | 297 | ||
293 | static int objdump_line__show(struct objdump_line *self, struct list_head *head, | 298 | static int objdump_line__show(struct objdump_line *self, struct list_head *head, |
@@ -353,7 +358,7 @@ static int ui_browser__refresh_entries(struct ui_browser *self) | |||
353 | pos = list_entry(self->first_visible_entry, struct objdump_line, node); | 358 | pos = list_entry(self->first_visible_entry, struct objdump_line, node); |
354 | 359 | ||
355 | list_for_each_entry_from(pos, head, node) { | 360 | list_for_each_entry_from(pos, head, node) { |
356 | bool current_entry = (self->first_visible_entry_idx + row) == self->index; | 361 | bool current_entry = ui_browser__is_current_entry(self, row); |
357 | SLsmg_gotorc(self->top + row, self->left); | 362 | SLsmg_gotorc(self->top + row, self->left); |
358 | objdump_line__show(pos, head, self->width, | 363 | objdump_line__show(pos, head, self->width, |
359 | he, len, current_entry); | 364 | he, len, current_entry); |