1
0
mirror of https://github.com/irssi/irssi.git synced 2024-06-09 06:20:45 +00:00

Merge pull request #958 from ailin-nemui/window-number-cmd

Make /1/2/3/... a setting
This commit is contained in:
ailin-nemui 2018-10-07 10:21:29 +02:00 committed by GitHub
commit 3257ce3b13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 100 deletions

View File

@ -159,105 +159,6 @@ aliases = {
WN = "WINDOW NEW HIDDEN";
WQUERY = "QUERY -window";
WW = "WHOWAS";
1 = "WINDOW GOTO 1";
2 = "WINDOW GOTO 2";
3 = "WINDOW GOTO 3";
4 = "WINDOW GOTO 4";
5 = "WINDOW GOTO 5";
6 = "WINDOW GOTO 6";
7 = "WINDOW GOTO 7";
8 = "WINDOW GOTO 8";
9 = "WINDOW GOTO 9";
10 = "WINDOW GOTO 10";
11 = "WINDOW GOTO 11";
12 = "WINDOW GOTO 12";
13 = "WINDOW GOTO 13";
14 = "WINDOW GOTO 14";
15 = "WINDOW GOTO 15";
16 = "WINDOW GOTO 16";
17 = "WINDOW GOTO 17";
18 = "WINDOW GOTO 18";
19 = "WINDOW GOTO 19";
20 = "WINDOW GOTO 20";
21 = "WINDOW GOTO 21";
22 = "WINDOW GOTO 22";
23 = "WINDOW GOTO 23";
24 = "WINDOW GOTO 24";
25 = "WINDOW GOTO 25";
26 = "WINDOW GOTO 26";
27 = "WINDOW GOTO 27";
28 = "WINDOW GOTO 28";
29 = "WINDOW GOTO 29";
30 = "WINDOW GOTO 30";
31 = "WINDOW GOTO 31";
32 = "WINDOW GOTO 32";
33 = "WINDOW GOTO 33";
34 = "WINDOW GOTO 34";
35 = "WINDOW GOTO 35";
36 = "WINDOW GOTO 36";
37 = "WINDOW GOTO 37";
38 = "WINDOW GOTO 38";
39 = "WINDOW GOTO 39";
40 = "WINDOW GOTO 40";
41 = "WINDOW GOTO 41";
42 = "WINDOW GOTO 42";
43 = "WINDOW GOTO 43";
44 = "WINDOW GOTO 44";
45 = "WINDOW GOTO 45";
46 = "WINDOW GOTO 46";
47 = "WINDOW GOTO 47";
48 = "WINDOW GOTO 48";
49 = "WINDOW GOTO 49";
50 = "WINDOW GOTO 50";
51 = "WINDOW GOTO 51";
52 = "WINDOW GOTO 52";
53 = "WINDOW GOTO 53";
54 = "WINDOW GOTO 54";
55 = "WINDOW GOTO 55";
56 = "WINDOW GOTO 56";
57 = "WINDOW GOTO 57";
58 = "WINDOW GOTO 58";
59 = "WINDOW GOTO 59";
60 = "WINDOW GOTO 60";
61 = "WINDOW GOTO 61";
62 = "WINDOW GOTO 62";
63 = "WINDOW GOTO 63";
64 = "WINDOW GOTO 64";
65 = "WINDOW GOTO 65";
66 = "WINDOW GOTO 66";
67 = "WINDOW GOTO 67";
68 = "WINDOW GOTO 68";
69 = "WINDOW GOTO 69";
70 = "WINDOW GOTO 70";
71 = "WINDOW GOTO 71";
72 = "WINDOW GOTO 72";
73 = "WINDOW GOTO 73";
74 = "WINDOW GOTO 74";
75 = "WINDOW GOTO 75";
76 = "WINDOW GOTO 76";
77 = "WINDOW GOTO 77";
78 = "WINDOW GOTO 78";
79 = "WINDOW GOTO 79";
80 = "WINDOW GOTO 80";
81 = "WINDOW GOTO 81";
82 = "WINDOW GOTO 82";
83 = "WINDOW GOTO 83";
84 = "WINDOW GOTO 84";
85 = "WINDOW GOTO 85";
86 = "WINDOW GOTO 86";
87 = "WINDOW GOTO 87";
88 = "WINDOW GOTO 88";
89 = "WINDOW GOTO 89";
90 = "WINDOW GOTO 90";
91 = "WINDOW GOTO 91";
92 = "WINDOW GOTO 92";
93 = "WINDOW GOTO 93";
94 = "WINDOW GOTO 94";
95 = "WINDOW GOTO 95";
96 = "WINDOW GOTO 96";
97 = "WINDOW GOTO 97";
98 = "WINDOW GOTO 98";
99 = "WINDOW GOTO 99";
};
statusbar = {

View File

@ -249,6 +249,7 @@ static void event_default_command(const char *data, void *server,
long diff;
cmdchars = settings_get_str("cmdchars");
signal_stop();
ptr = data;
while (*ptr != '\0' && *ptr != ' ') {
@ -338,7 +339,7 @@ void fe_core_commands_init(void)
signal_add("send command", (SIGNAL_FUNC) event_command);
signal_add_last("send command", (SIGNAL_FUNC) event_command_last);
signal_add("default command", (SIGNAL_FUNC) event_default_command);
signal_add_last("default command", (SIGNAL_FUNC) event_default_command);
signal_add("error command", (SIGNAL_FUNC) event_cmderror);
signal_add("list subcommands", (SIGNAL_FUNC) event_list_subcommands);

View File

@ -867,9 +867,22 @@ static void cmd_foreach_window(const char *data)
g_free(str);
}
static void cmd_window_default_command(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
{
if (!is_numeric(data, 0) ||
!settings_get_bool("window_number_commands")) {
return;
}
signal_emit("command window refnum", 3, data, server, item);
signal_stop();
}
void window_commands_init(void)
{
settings_add_bool("lookandfeel", "active_window_ignore_refnum", TRUE);
settings_add_bool("misc", "window_number_commands", TRUE);
signal_add("default command", (SIGNAL_FUNC) cmd_window_default_command);
command_bind("window", NULL, (SIGNAL_FUNC) cmd_window);
command_bind("window new", NULL, (SIGNAL_FUNC) cmd_window_new);
@ -944,4 +957,6 @@ void window_commands_deinit(void)
command_unbind("layout save", (SIGNAL_FUNC) windows_layout_save);
command_unbind("layout reset", (SIGNAL_FUNC) windows_layout_reset);
command_unbind("foreach window", (SIGNAL_FUNC) cmd_foreach_window);
signal_remove("default command", (SIGNAL_FUNC) cmd_window_default_command);
}