Deuglify channel state icons
[quassel.git] / src / uisupport / tabcompleter.cpp
index cfdf5d4..93a0fa4 100644 (file)
@@ -63,12 +63,14 @@ void TabCompleter::buildCompletionList() {
 
   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:
@@ -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();
     }