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 /Panel.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 'Panel.c')
-rw-r--r-- | Panel.c | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -49,6 +49,8 @@ void Panel_init(Panel* this, int x, int y, int w, int h, const ObjectClass* type this->y = y; this->w = w; this->h = h; + this->cursorX = 0; + this->cursorY = 0; this->eventHandlerState = NULL; this->items = Vector_new(type, owner, DEFAULT_SIZE); this->scrollV = 0; @@ -57,6 +59,7 @@ void Panel_init(Panel* this, int x, int y, int w, int h, const ObjectClass* type this->oldSelected = 0; this->selectedLen = 0; this->needsRedraw = true; + this->cursorOn = false; this->wasFocus = false; RichString_beginAllocated(this->header); this->defaultBar = fuBar; @@ -72,6 +75,11 @@ void Panel_done(Panel* this) { RichString_delete(&this->header); } +void Panel_setCursorToSelection(Panel* this) { + this->cursorY = this->y + this->selected - this->scrollV + 1; + this->cursorX = this->x + this->selectedLen - this->scrollH; +} + void Panel_setSelectionColor(Panel* this, ColorElements colorId) { this->selectionColorId = colorId; } @@ -330,7 +338,6 @@ void Panel_draw(Panel* this, bool force_redraw, bool focus, bool highlightSelect this->oldSelected = this->selected; this->wasFocus = focus; this->needsRedraw = false; - move(0, 0); } static int Panel_headerHeight(const Panel* this) { @@ -485,3 +492,16 @@ HandlerResult Panel_selectByTyping(Panel* this, int ch) { return IGNORED; } + +int Panel_getCh(Panel* this) { + if (this->cursorOn) { + move(this->cursorY, this->cursorX); + curs_set(1); + } else { + curs_set(0); + } +#ifdef HAVE_SET_ESCDELAY + set_escdelay(25); +#endif + return getch(); +} |