switch(static_cast<BufferInfo::Type>(currentIndex.data(NetworkModel::BufferTypeRole).toInt())) {
case BufferInfo::ChannelBuffer:
- IrcChannel *channel = network->ircChannel(bufferName);
- if(!channel)
- return;
- foreach(IrcUser *ircUser, channel->ircUsers()) {
- if(regex.indexIn(ircUser->nick()) > -1)
- completionMap[ircUser->nick().toLower()] = ircUser->nick();
+ { // scope is needed for local var declaration
+ IrcChannel *channel = network->ircChannel(bufferName);
+ if(!channel)
+ return;
+ foreach(IrcUser *ircUser, channel->ircUsers()) {
+ if(regex.indexIn(ircUser->nick()) > -1)
+ completionMap[ircUser->nick().toLower()] = ircUser->nick();
+ }
}
break;
case BufferInfo::QueryBuffer:
nextCompletion++;
// we're completing the first word of the line
- if(inputLine->text().length() == lastCompletionLength) {
+ if(inputLine->cursorPosition() == lastCompletionLength) {
inputLine->insert(nickSuffix);
lastCompletionLength += nickSuffix.length();
}