- if (not tabMode) {
- QString tabAbbrev = text().left(cursorPosition()).section(' ',-1,-1);
- tabCompleteList.clear();
- foreach(QString nick, nickList) {
- if(nick.toLower().startsWith(tabAbbrev.toLower())) {
- tabCompleteList << nick;
- }
- }
-
- tabCompleteList.sort();
- lastCompletionLength = tabAbbrev.length();
- tabMode = true;
- nextCompletion = tabCompleteList.begin();
- }
- if (nextCompletion != tabCompleteList.end()) {
- for (int i = 0; i < lastCompletionLength; i++) {
- backspace();
- }
- insert(*nextCompletion);
- lastCompletionLength = nextCompletion->length();
- nextCompletion++;
- } else if (tabCompleteList.end() != tabCompleteList.begin()) {
- nextCompletion = tabCompleteList.begin();
- }