Reduce code duplication

This commit is contained in:
Benny Baumann 2020-11-21 17:00:58 +01:00 committed by BenBE
parent c49ca61dd9
commit a7955c4966
1 changed files with 6 additions and 8 deletions

14
Panel.c
View File

@ -330,22 +330,20 @@ bool Panel_onKey(Panel* this, int key) {
switch (key) { switch (key) {
case KEY_DOWN: case KEY_DOWN:
case KEY_CTRL('N'): case KEY_CTRL('N'):
this->selected++;
break;
case KEY_UP:
case KEY_CTRL('P'):
this->selected--;
break;
#ifdef KEY_C_DOWN #ifdef KEY_C_DOWN
case KEY_C_DOWN: case KEY_C_DOWN:
#endif
this->selected++; this->selected++;
break; break;
#endif
case KEY_UP:
case KEY_CTRL('P'):
#ifdef KEY_C_UP #ifdef KEY_C_UP
case KEY_C_UP: case KEY_C_UP:
#endif
this->selected--; this->selected--;
break; break;
#endif
case KEY_LEFT: case KEY_LEFT:
case KEY_CTRL('B'): case KEY_CTRL('B'):
if (this->scrollH > 0) { if (this->scrollH > 0) {