diff options
author | Daniel Lange <DLange@git.local> | 2021-01-11 20:43:27 +0100 |
---|---|---|
committer | Daniel Lange <DLange@git.local> | 2021-01-11 20:43:27 +0100 |
commit | c55320e9e2a8916e911bcd39ab37b79e3a7d03b2 (patch) | |
tree | d6be9a09fdf7d6dc155de3429a70697ee2bb43b0 /InfoScreen.c | |
parent | 65357c8c46154de4e4eca14075bfe5523bb5fc14 (diff) | |
download | debian_htop-c55320e9e2a8916e911bcd39ab37b79e3a7d03b2.tar.gz debian_htop-c55320e9e2a8916e911bcd39ab37b79e3a7d03b2.tar.bz2 debian_htop-c55320e9e2a8916e911bcd39ab37b79e3a7d03b2.zip |
New upstream version 3.0.5upstream/3.0.5
Diffstat (limited to 'InfoScreen.c')
-rw-r--r-- | InfoScreen.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/InfoScreen.c b/InfoScreen.c index ceb29f7..9647b9f 100644 --- a/InfoScreen.c +++ b/InfoScreen.c @@ -19,14 +19,14 @@ static const char* const InfoScreenFunctions[] = {"Search ", "Filter ", "Refresh static const char* const InfoScreenKeys[] = {"F3", "F4", "F5", "Esc"}; -static int InfoScreenEvents[] = {KEY_F(3), KEY_F(4), KEY_F(5), 27}; +static const int InfoScreenEvents[] = {KEY_F(3), KEY_F(4), KEY_F(5), 27}; InfoScreen* InfoScreen_init(InfoScreen* this, const Process* process, FunctionBar* bar, int height, const char* panelHeader) { this->process = process; if (!bar) { bar = FunctionBar_new(InfoScreenFunctions, InfoScreenKeys, InfoScreenEvents); } - this->display = Panel_new(0, 1, COLS, height, false, Class(ListItem), bar); + this->display = Panel_new(0, 1, COLS, height, Class(ListItem), false, bar); this->inc = IncSet_new(bar); this->lines = Vector_new(this->display->items->type, true, DEFAULT_SIZE); Panel_setHeader(this->display, panelHeader); @@ -44,21 +44,21 @@ void InfoScreen_drawTitled(InfoScreen* this, const char* fmt, ...) { va_list ap; va_start(ap, fmt); - char* title = xMalloc(COLS + 1); - int len = vsnprintf(title, COLS + 1, fmt, ap); + char title[COLS + 1]; + int len = vsnprintf(title, sizeof(title), fmt, ap); + va_end(ap); + if (len > COLS) { memset(&title[COLS - 3], '.', 3); } attrset(CRT_colors[METER_TEXT]); mvhline(0, 0, ' ', COLS); - mvwprintw(stdscr, 0, 0, title); + mvaddstr(0, 0, title); attrset(CRT_colors[DEFAULT_COLOR]); - this->display->needsRedraw = true; - Panel_draw(this->display, true, true); + Panel_draw(this->display, true, true, true, false); + IncSet_drawBar(this->inc); - free(title); - va_end(ap); } void InfoScreen_addLine(InfoScreen* this, const char* line) { @@ -89,7 +89,8 @@ void InfoScreen_run(InfoScreen* this) { bool looping = true; while (looping) { - Panel_draw(panel, true, true); + Panel_draw(panel, false, true, true, false); + IncSet_drawBar(this->inc); if (this->inc->active) { (void) move(LINES - 1, CRT_cursorX); |