94
94
this->selected = 0;
95
95
this->oldSelected = 0;
96
96
this->needsRedraw = true;
97
RichString_prune(&(this->header));
98
98
if (String_eq(CRT_termType, "linux"))
99
this->scrollHAmount = 40;
99
this->scrollHAmount = 20;
101
101
this->scrollHAmount = 5;
329
void Panel_onKey(Panel* this, int key) {
329
bool Panel_onKey(Panel* this, int key) {
330
330
assert (this != NULL);
333
333
if (this->selected + 1 < Vector_size(this->items))
334
334
this->selected++;
337
337
if (this->selected > 0)
338
338
this->selected--;
342
if (this->selected + 1 < Vector_size(this->items)) {
344
if (this->scrollV < Vector_size(this->items) - this->h) {
346
this->needsRedraw = true;
353
if (this->selected > 0) {
355
if (this->scrollV > 0) {
357
this->needsRedraw = true;
341
363
if (this->scrollH > 0) {
342
this->scrollH -= this->scrollHAmount;
343
365
this->needsRedraw = true;
347
this->scrollH += this->scrollHAmount;
348
370
this->needsRedraw = true;
351
this->selected -= this->h;
373
this->selected -= (this->h - 1);
374
this->scrollV -= (this->h - 1);
352
375
if (this->selected < 0)
353
376
this->selected = 0;
377
if (this->scrollV < 0)
379
this->needsRedraw = true;
356
this->selected += this->h;
382
this->selected += (this->h - 1);
357
383
int size = Vector_size(this->items);
358
384
if (this->selected >= size)
359
385
this->selected = size - 1;
386
this->scrollV += (this->h - 1);
387
if (this->scrollV >= MAX(0, size - this->h))
388
this->scrollV = MAX(0, size - this->h - 1);
389
this->needsRedraw = true;
362
392
this->selected = 0;
365
395
this->selected = Vector_size(this->items) - 1;