Skip to content

Commit

Permalink
Fix incorrect CAPS-LOCK and NUM-LOCK key handling (fixes gwsw/less#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
rivy committed Jan 29, 2019
1 parent 5b644b8 commit 409dbc8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,6 @@
#define SK_F1 14
#define SK_BACKTAB 15
#define SK_CTL_BACKSPACE 16
#define SK_CAPS_LOCK 17
#define SK_NUM_LOCK 18
#define SK_CONTROL_K 40
4 changes: 4 additions & 0 deletions decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ static unsigned char edittable[] =
ESC,'j',0, EC_DOWN, /* ESC j */
SK(SK_DOWN_ARROW),0, EC_DOWN, /* DOWNARROW */
CONTROL('G'),0, EC_ABORT, /* CTRL-G */
SK(SK_CAPS_LOCK),0, EC_NOACTION, /* CAPS-LOCK */
SK(SK_NUM_LOCK),0, EC_NOACTION, /* NUM-LOCK */
SK(SK_PAGE_DOWN),0, EC_NOACTION, /* PAGE-UP */
SK(SK_PAGE_UP),0, EC_NOACTION, /* PAGE-DOWN */
};

/*
Expand Down
8 changes: 8 additions & 0 deletions screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,8 @@ special_key_str(key)
static char k_pagedown[] = { '\340', PCK_PAGEDOWN, 0 };
static char k_pageup[] = { '\340', PCK_PAGEUP, 0 };
static char k_f1[] = { '\340', PCK_F1, 0 };
static char k_caps_lock[] = {'\340', PCK_CAPS_LOCK, 0};
static char k_num_lock[] = {'\340', PCK_NUM_LOCK, 0};
#endif
#if !MSDOS_COMPILER
char *sp = tbuf;
Expand Down Expand Up @@ -1012,6 +1014,12 @@ special_key_str(key)
case SK_BACKTAB:
s = k_backtab;
break;
case SK_CAPS_LOCK:
s = k_caps_lock;
break;
case SK_NUM_LOCK:
s = k_num_lock;
break;
#else
case SK_RIGHT_ARROW:
s = ltgetstr("kr", &sp);
Expand Down

0 comments on commit 409dbc8

Please sign in to comment.