diff options
author | Daniel Lange <DLange@git.local> | 2022-05-02 16:04:21 +0200 |
---|---|---|
committer | Daniel Lange <DLange@git.local> | 2022-05-02 16:04:21 +0200 |
commit | 1b805a31720727008b32b1129a167758519fd4db (patch) | |
tree | 900c84e10a25f2c8eaeec3ae54f1365688ce02a4 /IncSet.c | |
parent | a6822e98434cf7da6fab033898094976d881ee0f (diff) | |
download | debian_htop-1b805a31720727008b32b1129a167758519fd4db.tar.gz debian_htop-1b805a31720727008b32b1129a167758519fd4db.tar.bz2 debian_htop-1b805a31720727008b32b1129a167758519fd4db.zip |
New upstream version 3.2.0upstream/3.2.0
Diffstat (limited to 'IncSet.c')
-rw-r--r-- | IncSet.c | 41 |
1 files changed, 27 insertions, 14 deletions
@@ -85,7 +85,7 @@ static void updateWeakPanel(const IncSet* this, Panel* panel, Vector* lines) { const char* incFilter = this->modes[INC_FILTER].buffer; for (int i = 0; i < Vector_size(lines); i++) { ListItem* line = (ListItem*)Vector_get(lines, i); - if (String_contains_i(line->value, incFilter)) { + if (String_contains_i(line->value, incFilter, true)) { Panel_add(panel, (Object*)line); if (selected == (Object*)line) { Panel_setSelected(panel, n); @@ -105,10 +105,10 @@ static void updateWeakPanel(const IncSet* this, Panel* panel, Vector* lines) { } } -static bool search(const IncMode* mode, Panel* panel, IncMode_GetPanelValue getPanelValue) { +static bool search(const IncSet* this, Panel* panel, IncMode_GetPanelValue getPanelValue) { int size = Panel_size(panel); for (int i = 0; i < size; i++) { - if (String_contains_i(getPanelValue(panel, i), mode->buffer)) { + if (String_contains_i(getPanelValue(panel, i), this->active->buffer, true)) { Panel_setSelected(panel, i); return true; } @@ -117,6 +117,21 @@ static bool search(const IncMode* mode, Panel* panel, IncMode_GetPanelValue getP return false; } +void IncSet_activate(IncSet* this, IncType type, Panel* panel) { + this->active = &(this->modes[type]); + panel->currentBar = this->active->bar; + panel->cursorOn = true; + this->panel = panel; + IncSet_drawBar(this, CRT_colors[FUNCTION_BAR]); +} + +static void IncSet_deactivate(IncSet* this, Panel* panel) { + this->active = NULL; + Panel_setDefaultBar(panel); + panel->cursorOn = false; + FunctionBar_draw(this->defaultBar); +} + static bool IncMode_find(const IncMode* mode, Panel* panel, IncMode_GetPanelValue getPanelValue, int step) { int size = Panel_size(panel); int here = Panel_getSelectedIndex(panel); @@ -133,7 +148,7 @@ static bool IncMode_find(const IncMode* mode, Panel* panel, IncMode_GetPanelValu return false; } - if (String_contains_i(getPanelValue(panel, i), mode->buffer)) { + if (String_contains_i(getPanelValue(panel, i), mode->buffer, true)) { Panel_setSelected(panel, i); return true; } @@ -194,12 +209,11 @@ bool IncSet_handleKey(IncSet* this, int ch, Panel* panel, IncMode_GetPanelValue IncMode_reset(mode); } } - this->active = NULL; - Panel_setDefaultBar(panel); + IncSet_deactivate(this, panel); doSearch = false; } if (doSearch) { - this->found = search(mode, panel, getPanelValue); + this->found = search(this, panel, getPanelValue); } if (filterChanged && lines) { updateWeakPanel(this, panel, lines); @@ -212,14 +226,13 @@ const char* IncSet_getListItemValue(Panel* panel, int i) { return l ? l->value : ""; } -void IncSet_activate(IncSet* this, IncType type, Panel* panel) { - this->active = &(this->modes[type]); - panel->currentBar = this->active->bar; -} - -void IncSet_drawBar(const IncSet* this) { +void IncSet_drawBar(const IncSet* this, int attr) { if (this->active) { - FunctionBar_drawExtra(this->active->bar, this->active->buffer, (this->active->isFilter || this->found) ? -1 : CRT_colors[FAILED_SEARCH], true); + if (!this->active->isFilter && !this->found) + attr = CRT_colors[FAILED_SEARCH]; + int cursorX = FunctionBar_drawExtra(this->active->bar, this->active->buffer, attr, true); + this->panel->cursorY = LINES - 1; + this->panel->cursorX = cursorX; } else { FunctionBar_draw(this->defaultBar); } |