summaryrefslogtreecommitdiff
path: root/src/common/completion.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2007-05-24 12:59:16 +0000
committerSebastien Helleu <flashcode@flashtux.org>2007-05-24 12:59:16 +0000
commit537e1781a61ed1a820e9921ceee49df2d715e14c (patch)
tree4314ca1271b2da0d5e25902e88c24847c6baabc1 /src/common/completion.c
parentd66bfc2458bbd738a3791b87073299a701a8518c (diff)
downloadweechat-537e1781a61ed1a820e9921ceee49df2d715e14c.zip
Fixed nick completion bug: now self nick is always at the end of completion list
Diffstat (limited to 'src/common/completion.c')
-rw-r--r--src/common/completion.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/src/common/completion.c b/src/common/completion.c
index ec07d07ac..613a25203 100644
--- a/src/common/completion.c
+++ b/src/common/completion.c
@@ -282,6 +282,9 @@ void
completion_list_add (t_completion *completion, char *word,
int nick_completion, int position)
{
+ if (!word || !word[0])
+ return;
+
if (!completion->base_word || !completion->base_word[0]
|| (nick_completion && (completion_nickncmp (completion->base_word, word,
strlen (completion->base_word)) == 0))
@@ -544,11 +547,9 @@ void
completion_list_add_self_nick (t_completion *completion)
{
if (completion->server)
- {
completion_list_add (completion,
((t_irc_server *)(completion->server))->nick,
0, WEELIST_POS_SORT);
- }
}
/*
@@ -583,11 +584,6 @@ completion_list_add_server_nicks (t_completion *completion)
}
}
- /* add self nick at the end */
- completion_list_add (completion,
- ((t_irc_server *)(completion->server))->nick,
- 1, WEELIST_POS_END);
-
/* add current channel nicks at beginning */
if (completion->channel && (((t_irc_channel *)(completion->channel))->type == CHANNEL_TYPE_CHANNEL))
{
@@ -599,6 +595,12 @@ completion_list_add_server_nicks (t_completion *completion)
}
}
+ /* add self nick at the end */
+ if (completion->server)
+ completion_list_add (completion,
+ ((t_irc_server *)(completion->server))->nick,
+ 1, WEELIST_POS_END);
+
completion->arg_is_nick = 1;
}
}
@@ -625,12 +627,6 @@ completion_list_add_channel_nicks (t_completion *completion)
1, WEELIST_POS_SORT);
}
- /* add self nick at the end */
- if (completion->server)
- completion_list_add (completion,
- ((t_irc_server *)(completion->server))->nick,
- 1, WEELIST_POS_END);
-
/* add nicks speaking recently on this channel */
if (cfg_look_nick_completion_smart)
{
@@ -643,6 +639,12 @@ completion_list_add_channel_nicks (t_completion *completion)
1, WEELIST_POS_BEGINNING);
}
}
+
+ /* add self nick at the end */
+ if (completion->server)
+ completion_list_add (completion,
+ ((t_irc_server *)(completion->server))->nick,
+ 1, WEELIST_POS_END);
}
if ((((t_irc_channel *)(completion->channel))->type == CHANNEL_TYPE_PRIVATE)
|| (((t_irc_channel *)(completion->channel))->type == CHANNEL_TYPE_DCC_CHAT))
@@ -1469,12 +1471,7 @@ completion_nick (t_completion *completion)
ptr_nick->nick,
WEELIST_POS_SORT);
}
- /* add self nick at the end */
- if (completion->server)
- weelist_add (&(completion->completion_list),
- &(completion->last_completion),
- ((t_irc_server *)(completion->server))->nick,
- WEELIST_POS_END);
+
/* add nicks speaking recently on this channel */
if (cfg_look_nick_completion_smart)
{
@@ -1489,6 +1486,14 @@ completion_nick (t_completion *completion)
WEELIST_POS_BEGINNING);
}
}
+
+ /* add self nick at the end */
+ if (completion->server)
+ weelist_add (&(completion->completion_list),
+ &(completion->last_completion),
+ ((t_irc_server *)(completion->server))->nick,
+ WEELIST_POS_END);
+
((t_irc_channel *)(completion->channel))->nick_completion_reset = 0;
}