X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Ftabcompleter.cpp;h=93a0fa4c57ff387ad8d4f1f26074aa8971e5e6a0;hp=cfdf5d4c014bc064f9fd4fb82dd63f1f171b1de8;hb=7c9c1b348382b8b77f96a883945c522d32a478d5;hpb=76d08e513d6aad5964786edc49f172d8b9481951 diff --git a/src/uisupport/tabcompleter.cpp b/src/uisupport/tabcompleter.cpp index cfdf5d4c..93a0fa4c 100644 --- a/src/uisupport/tabcompleter.cpp +++ b/src/uisupport/tabcompleter.cpp @@ -63,12 +63,14 @@ void TabCompleter::buildCompletionList() { switch(static_cast(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: @@ -114,7 +116,7 @@ void TabCompleter::complete() { 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(); }