1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-13 00:53:01 +01:00

make ctrl-] [ keys switch pages

This commit is contained in:
Jfreegman 2013-12-06 20:56:30 -05:00
parent f942982f4e
commit d232538317
3 changed files with 10 additions and 6 deletions

BIN
src/toxic_windows Normal file

Binary file not shown.

View File

@ -29,8 +29,11 @@
#define EXIT_SUCCESS 0
#define EXIT_FAILURE 1
#define T_KEY_KILL 0xB /* ASCII code for ctrl-k */
#define T_KEY_DISCARD 0x15 /* ASCII code for ctrl-u */
/* ASCII key codes */
#define T_KEY_KILL 0xB /* ctrl-k */
#define T_KEY_DISCARD 0x15 /* ctrl-u */
#define T_KEY_NEXT 0x1D /* ctrl-] */
#define T_KEY_PREV 0x1B /* ctrl-[ */
/* Curses foreground colours (background is black) */
enum {
@ -80,12 +83,13 @@ struct ToxWindow {
void(*onFileData)(ToxWindow *, Tox *, int, uint8_t, uint8_t *, uint16_t);
char name[TOX_MAX_NAME_LENGTH];
int num;
bool active;
int x;
bool alert0;
bool alert1;
bool alert2;
int num;
int x;
ChatContext *chatwin;
PromptBuf *promptbuf;

View File

@ -221,7 +221,7 @@ void set_next_window(int ch)
ToxWindow *inf = active_window;
while (true) {
if (ch == '\t') {
if (ch == '\t' || ch == T_KEY_NEXT) {
if (++active_window > end)
active_window = windows;
} else if (--active_window < windows)
@ -348,7 +348,7 @@ void draw_active_window(Tox *m)
ch = getch();
#endif
if (ch == '\t' || ch == KEY_BTAB)
if (ch == '\t' || ch == KEY_BTAB || ch == T_KEY_NEXT || ch == T_KEY_PREV)
set_next_window((int) ch);
else if (ch != ERR)
a->onKey(a, m, ch);