Skip to content

Commit

Permalink
Make Dec and Inc consistent on F7 and F8 as per the main panel
Browse files Browse the repository at this point in the history
* minus and plus keys still work
* this prevents the ugly left flush "- " and "+ " key labels
* Unicode "-" and "+" are still too hard in 2025, see PR htop-dev#1613 😭

Closes htop-dev#1613
  • Loading branch information
Daniel Lange authored and Daniel Lange committed Feb 21, 2025
1 parent 5954fa0 commit faa4832
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions DisplayOptionsPanel.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ in the source distribution for its full text.
#include "ScreensPanel.h"


static const char* const DisplayOptionsFunctions[] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", "Done ", NULL};
static const char* const DisplayOptionsFunctions[] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", "Done ", NULL};

static const char* const DisplayOptionsDecIncFunctions[] = {"Dec ", "Inc ", " ", "Done ", NULL};
static const char* const DisplayOptionsDecIncKeys[] = {"- ", "+ ", " ", "F10", NULL};
static const int DisplayOptionsDecIncEvents[] = {'-', '+', ERR, KEY_F(10)};
static const char* const DisplayOptionsDecIncFunctions[] = {" ", " ", " ", " ", " ", " ", "Dec ", "Inc ", " ", "Done ", NULL};
static const char* const DisplayOptionsDecIncKeys[] = {" " , " " , " " , " " , " " , " " , "F7" , "F8" , " " , "F10" , NULL};
static const int DisplayOptionsDecIncEvents[] = {'-', KEY_F(7), '+', KEY_F(8), ERR, KEY_F(10)};

static void DisplayOptionsPanel_delete(Object* object) {
DisplayOptionsPanel* this = (DisplayOptionsPanel*) object;
Expand Down Expand Up @@ -66,12 +66,14 @@ static HandlerResult DisplayOptionsPanel_eventHandler(Panel* super, int ch) {
}
break;
case '-':
case KEY_F(7):
if (OptionItem_kind(selected) == OPTION_ITEM_NUMBER) {
NumberItem_decrease((NumberItem*)selected);
result = HANDLED;
}
break;
case '+':
case KEY_F(8):
if (OptionItem_kind(selected) == OPTION_ITEM_NUMBER) {
NumberItem_increase((NumberItem*)selected);
result = HANDLED;
Expand Down

0 comments on commit faa4832

Please sign in to comment.