mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Adding irssi style Alt-Left/Right window navigation
This commit is contained in:
parent
ce3b99f577
commit
8be4cd1f27
@ -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.");
|
||||
|
@ -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';
|
||||
|
Loading…
Reference in New Issue
Block a user