mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Nick completion now completes nicks from all channels in active window,
except when completing the first word in line only nicks in active channel are completed. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@914 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
9ab8b13fd8
commit
fda66b542c
@ -404,14 +404,50 @@ GList *completion_get_channels(SERVER_REC *server, const char *word)
|
||||
return list;
|
||||
}
|
||||
|
||||
static void complete_window_nicks(GList **list, WINDOW_REC *window,
|
||||
const char *word, const char *linestart)
|
||||
{
|
||||
CHANNEL_REC *channel;
|
||||
GList *tmplist;
|
||||
GSList *tmp;
|
||||
const char *nickprefix;
|
||||
|
||||
nickprefix = *linestart != '\0' ? NULL :
|
||||
settings_get_str("completion_char");
|
||||
|
||||
channel = CHANNEL(window->active);
|
||||
|
||||
/* first the active channel */
|
||||
if (channel != NULL) {
|
||||
tmplist = completion_channel_nicks(channel, word, nickprefix);
|
||||
*list = completion_joinlist(*list, tmplist);
|
||||
}
|
||||
|
||||
if (nickprefix != NULL) {
|
||||
/* completing nick at the start of line - probably answering
|
||||
to some other nick, don't even try to complete from
|
||||
non-active channels */
|
||||
return;
|
||||
}
|
||||
|
||||
/* then the rest */
|
||||
for (tmp = window->items; tmp != NULL; tmp = tmp->next) {
|
||||
channel = CHANNEL(tmp->data);
|
||||
if (channel != NULL && tmp->data != window->active) {
|
||||
tmplist = completion_channel_nicks(channel, word,
|
||||
nickprefix);
|
||||
*list = completion_joinlist(*list, tmplist);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void sig_complete_word(GList **list, WINDOW_REC *window,
|
||||
const char *word, const char *linestart)
|
||||
{
|
||||
SERVER_REC *server;
|
||||
CHANNEL_REC *channel;
|
||||
QUERY_REC *query;
|
||||
GList *tmplist;
|
||||
const char *cmdchars, *nickprefix;
|
||||
const char *cmdchars;
|
||||
char *prefix;
|
||||
|
||||
g_return_if_fail(list != NULL);
|
||||
@ -454,11 +490,7 @@ static void sig_complete_word(GList **list, WINDOW_REC *window,
|
||||
} else if (channel != NULL) {
|
||||
/* nick completion .. we could also be completing a nick
|
||||
after /MSG from nicks in channel */
|
||||
nickprefix = *linestart != '\0' ? NULL :
|
||||
settings_get_str("completion_char");
|
||||
|
||||
tmplist = completion_channel_nicks(channel, word, nickprefix);
|
||||
*list = completion_joinlist(*list, tmplist);
|
||||
complete_window_nicks(list, window, word, linestart);
|
||||
}
|
||||
|
||||
if (*list != NULL) signal_stop();
|
||||
|
Loading…
Reference in New Issue
Block a user