mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
refactor into array of a struct
...instead of having two separate arrays. Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
This commit is contained in:
parent
0242576d7c
commit
74415ae71d
@ -2083,11 +2083,21 @@ _cmd_ac_complete_params(ProfWin* window, const char* const input, gboolean previ
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gchar* cmds[] = { "/prefs", "/disco", "/room", "/autoping", "/mainwin", "/inputwin" };
|
struct
|
||||||
Autocomplete completers[] = { prefs_ac, disco_ac, room_ac, autoping_ac, winpos_ac, winpos_ac };
|
{
|
||||||
|
gchar* cmd;
|
||||||
|
Autocomplete completer;
|
||||||
|
} ac_cmds[] = {
|
||||||
|
{ "/prefs", prefs_ac },
|
||||||
|
{ "/disco", disco_ac },
|
||||||
|
{ "/room", room_ac },
|
||||||
|
{ "/autoping", autoping_ac },
|
||||||
|
{ "/mainwin", winpos_ac },
|
||||||
|
{ "/inputwin", winpos_ac },
|
||||||
|
};
|
||||||
|
|
||||||
for (int i = 0; i < ARRAY_SIZE(cmds); i++) {
|
for (int i = 0; i < ARRAY_SIZE(ac_cmds); i++) {
|
||||||
result = autocomplete_param_with_ac(input, cmds[i], completers[i], TRUE, previous);
|
result = autocomplete_param_with_ac(input, ac_cmds[i].cmd, ac_cmds[i].completer, TRUE, previous);
|
||||||
if (result) {
|
if (result) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user