1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-23 21:45:30 +00:00

Adding irssi style Alt-Left/Right window navigation

This commit is contained in:
Jesse R. Adams 2013-09-25 12:51:54 -07:00
parent ce3b99f577
commit 8be4cd1f27
2 changed files with 23 additions and 0 deletions

View File

@ -1289,6 +1289,8 @@ cons_navigation_help(void)
cons_show("");
cons_show("Alt-1 : This console window.");
cons_show("Alt-2..Alt-0 : Chat windows.");
cons_show("Alt-LEFT : Previous chat window");
cons_show("Alt-RIGHT : Next chat window");
cons_show("F1 : This console window.");
cons_show("F2..F10 : Chat windows.");
cons_show("UP, DOWN : Navigate input history.");

View File

@ -40,6 +40,7 @@
#include "log.h"
#include "profanity.h"
#include "ui/ui.h"
#include "ui/windows.h"
#include "xmpp/xmpp.h"
#define _inp_win_refresh() prefresh(inp_win, 0, pad_start, rows-1, 0, rows-1, cols-1)
@ -559,6 +560,8 @@ _handle_alt_key(char *input, int *size, int key)
{
int end_del = getcurx(inp_win);
int start_del = end_del;
int current = wins_get_current_num();
int new;
switch (key)
{
@ -592,6 +595,24 @@ _handle_alt_key(char *input, int *size, int key)
case '0':
ui_switch_win(0);
break;
case KEY_LEFT:
if (current == 0) {
new = 9;
} else {
new = current - 1;
}
ui_switch_win(new);
break;
case KEY_RIGHT:
if (current == 9) {
new = 0;
} else {
new = current + 1;
}
ui_switch_win(new);
break;
case 263:
case 127:
input[*size] = '\0';