1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Debug alt-backspace

This commit is contained in:
James Booth 2013-03-02 23:01:12 +00:00
parent be379afa5d
commit 35f905e304

View File

@ -49,6 +49,7 @@ static int pad_start = 0;
static int rows, cols; static int rows, cols;
static int _handle_edit(int result, const wint_t ch, char *input, int *size); static int _handle_edit(int result, const wint_t ch, char *input, int *size);
static int _handle_alt_key(char *input, int *size, int key);
static int _printable(const wint_t ch); static int _printable(const wint_t ch);
static void _clear_input(void); static void _clear_input(void);
static void _go_to_end(int display_size); static void _go_to_end(int display_size);
@ -359,45 +360,10 @@ _handle_edit(int result, const wint_t ch, char *input, int *size)
switch(ch) { switch(ch) {
case 27: // ESC case 27: // ESC
// check for ALT-num // check for ALT-key
next_ch = wgetch(inp_win); next_ch = wgetch(inp_win);
if (next_ch != ERR) { if (next_ch != ERR) {
switch (next_ch) return _handle_alt_key(input, size, next_ch);
{
case '1':
ui_switch_win(0);
break;
case '2':
ui_switch_win(1);
break;
case '3':
ui_switch_win(2);
break;
case '4':
ui_switch_win(3);
break;
case '5':
ui_switch_win(4);
break;
case '6':
ui_switch_win(5);
break;
case '7':
ui_switch_win(6);
break;
case '8':
ui_switch_win(7);
break;
case '9':
ui_switch_win(8);
break;
case '0':
ui_switch_win(9);
break;
default:
break;
}
return 1;
} else { } else {
*size = 0; *size = 0;
inp_win_reset(); inp_win_reset();
@ -547,6 +513,51 @@ _handle_edit(int result, const wint_t ch, char *input, int *size)
} }
} }
static int
_handle_alt_key(char *input, int *size, int key)
{
switch (key)
{
case '1':
ui_switch_win(0);
break;
case '2':
ui_switch_win(1);
break;
case '3':
ui_switch_win(2);
break;
case '4':
ui_switch_win(3);
break;
case '5':
ui_switch_win(4);
break;
case '6':
ui_switch_win(5);
break;
case '7':
ui_switch_win(6);
break;
case '8':
ui_switch_win(7);
break;
case '9':
ui_switch_win(8);
break;
case '0':
ui_switch_win(9);
break;
case 127:
cons_debug("PRESSED ALT BACKSPACE");
return 1;
break;
default:
break;
}
return 1;
}
static void static void
_go_to_end(int display_size) _go_to_end(int display_size)
{ {