Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Altkeys #662

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,30 @@ static int key_parse(const char **bind)
}
}

if (strncasecmp(*bind, "alt", 3) == 0) {
return 0x300+toupper(bind[0][4]) - 'A' + 1;
}

if (strncasecmp(*bind, "tab", 3) == 0) {
return T_KEY_TAB;
}

if (strncasecmp(*bind, "up", 2) == 0) {
return KEY_UP;
}

if (strncasecmp(*bind, "down", 4) == 0) {
return KEY_DOWN;
}

if (strncasecmp(*bind, "right", 5) == 0) {
return KEY_RIGHT;
}

if (strncasecmp(*bind, "left", 4) == 0) {
return KEY_LEFT;
}

if (strncasecmp(*bind, "page", 4) == 0) {
return len == 6 ? KEY_PPAGE : KEY_NPAGE;
}
Expand Down
27 changes: 27 additions & 0 deletions src/toxic_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,33 @@
#define T_KEY_C_DOWN 0x20D /* ctrl-down arrow */
#define T_KEY_TAB 0x09 /* TAB key */

#define T_KEY_A_A 0x301
#define T_KEY_A_B 0x302
#define T_KEY_A_C 0x303
#define T_KEY_A_D 0x304
#define T_KEY_A_E 0x305
#define T_KEY_A_F 0x306
#define T_KEY_A_G 0x307
#define T_KEY_A_H 0x308
#define T_KEY_A_I 0x309
#define T_KEY_A_J 0x30a
#define T_KEY_A_K 0x30b
#define T_KEY_A_L 0x30c
#define T_KEY_A_M 0x30d
#define T_KEY_A_N 0x30e
#define T_KEY_A_O 0x30f
#define T_KEY_A_P 0x310
#define T_KEY_A_Q 0x311
#define T_KEY_A_R 0x312
#define T_KEY_A_S 0x313
#define T_KEY_A_T 0x314
#define T_KEY_A_U 0x315
#define T_KEY_A_V 0x316
#define T_KEY_A_W 0x317
#define T_KEY_A_X 0x318
#define T_KEY_A_Y 0x319
#define T_KEY_A_Z 0x31a

#define ONLINE_CHAR "o"
#define OFFLINE_CHAR "o"

Expand Down
30 changes: 30 additions & 0 deletions src/windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,36 @@ static struct key_sequence_codes {
{ L"[1;5B", T_KEY_C_DOWN },
{ L"[1;5C", T_KEY_C_RIGHT },
{ L"[1;5D", T_KEY_C_LEFT },
{ L"[A", KEY_UP },
{ L"[B", KEY_DOWN },
{ L"[C", KEY_RIGHT },
{ L"[D", KEY_LEFT },
{ L"a", T_KEY_A_A },
{ L"b", T_KEY_A_B },
{ L"c", T_KEY_A_C },
{ L"d", T_KEY_A_D },
{ L"e", T_KEY_A_E },
{ L"f", T_KEY_A_F },
{ L"g", T_KEY_A_G },
{ L"h", T_KEY_A_H },
{ L"i", T_KEY_A_I },
{ L"j", T_KEY_A_J },
{ L"k", T_KEY_A_K },
{ L"l", T_KEY_A_L },
{ L"m", T_KEY_A_M },
{ L"n", T_KEY_A_N },
{ L"o", T_KEY_A_O },
{ L"p", T_KEY_A_P },
{ L"q", T_KEY_A_Q },
{ L"r", T_KEY_A_R },
{ L"s", T_KEY_A_S },
{ L"t", T_KEY_A_T },
{ L"u", T_KEY_A_U },
{ L"v", T_KEY_A_V },
{ L"w", T_KEY_A_W },
{ L"x", T_KEY_A_X },
{ L"y", T_KEY_A_Y },
{ L"z", T_KEY_A_Z },
{ NULL, 0 }
};

Expand Down