| .. | .. |
|---|
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0 |
|---|
| 2 | | -#include "../util.h" |
|---|
| 3 | | -#include "../string2.h" |
|---|
| 4 | | -#include "../config.h" |
|---|
| 5 | | -#include "../../perf.h" |
|---|
| 2 | +#include "../util/string2.h" |
|---|
| 3 | +#include "../util/config.h" |
|---|
| 6 | 4 | #include "libslang.h" |
|---|
| 7 | 5 | #include "ui.h" |
|---|
| 8 | 6 | #include "util.h" |
|---|
| .. | .. |
|---|
| 15 | 13 | #include "browser.h" |
|---|
| 16 | 14 | #include "helpline.h" |
|---|
| 17 | 15 | #include "keysyms.h" |
|---|
| 18 | | -#include "../color.h" |
|---|
| 19 | | -#include "sane_ctype.h" |
|---|
| 16 | +#include "../util/color.h" |
|---|
| 17 | +#include <linux/ctype.h> |
|---|
| 18 | +#include <linux/zalloc.h> |
|---|
| 20 | 19 | |
|---|
| 21 | 20 | static int ui_browser__percent_color(struct ui_browser *browser, |
|---|
| 22 | 21 | double percent, bool current) |
|---|
| .. | .. |
|---|
| 346 | 345 | SLsmg_fill_region(browser->y + row + browser->extra_title_lines, browser->x, |
|---|
| 347 | 346 | browser->rows - row, width, ' '); |
|---|
| 348 | 347 | |
|---|
| 348 | + if (browser->nr_entries == 0 && browser->no_samples_msg) |
|---|
| 349 | + __ui__info_window(NULL, browser->no_samples_msg, NULL); |
|---|
| 349 | 350 | return 0; |
|---|
| 350 | 351 | } |
|---|
| 351 | 352 | |
|---|
| .. | .. |
|---|
| 594 | 595 | break; |
|---|
| 595 | 596 | |
|---|
| 596 | 597 | *bg = '\0'; |
|---|
| 597 | | - bg = ltrim(++bg); |
|---|
| 598 | + bg = skip_spaces(bg + 1); |
|---|
| 598 | 599 | ui_browser__colorsets[i].bg = bg; |
|---|
| 599 | 600 | ui_browser__colorsets[i].fg = fg; |
|---|
| 600 | 601 | return 0; |
|---|
| .. | .. |
|---|
| 611 | 612 | browser->top = browser->entries; |
|---|
| 612 | 613 | break; |
|---|
| 613 | 614 | case SEEK_CUR: |
|---|
| 614 | | - browser->top = browser->top + browser->top_idx + offset; |
|---|
| 615 | + browser->top = (char **)browser->top + offset; |
|---|
| 615 | 616 | break; |
|---|
| 616 | 617 | case SEEK_END: |
|---|
| 617 | | - browser->top = browser->top + browser->nr_entries - 1 + offset; |
|---|
| 618 | + browser->top = (char **)browser->entries + browser->nr_entries - 1 + offset; |
|---|
| 618 | 619 | break; |
|---|
| 619 | 620 | default: |
|---|
| 620 | 621 | return; |
|---|
| 621 | 622 | } |
|---|
| 623 | + assert((char **)browser->top < (char **)browser->entries + browser->nr_entries); |
|---|
| 624 | + assert((char **)browser->top >= (char **)browser->entries); |
|---|
| 622 | 625 | } |
|---|
| 623 | 626 | |
|---|
| 624 | 627 | unsigned int ui_browser__argv_refresh(struct ui_browser *browser) |
|---|
| .. | .. |
|---|
| 630 | 633 | browser->top = browser->entries; |
|---|
| 631 | 634 | |
|---|
| 632 | 635 | pos = (char **)browser->top; |
|---|
| 633 | | - while (idx < browser->nr_entries) { |
|---|
| 636 | + while (idx < browser->nr_entries && |
|---|
| 637 | + row < (unsigned)SLtt_Screen_Rows - 1) { |
|---|
| 638 | + assert(pos < (char **)browser->entries + browser->nr_entries); |
|---|
| 634 | 639 | if (!browser->filter || !browser->filter(browser, *pos)) { |
|---|
| 635 | 640 | ui_browser__gotorc(browser, row, 0); |
|---|
| 636 | 641 | browser->write(browser, pos, row); |
|---|