projects
/
quassel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- small tweak to tabcompletion
[quassel.git]
/
gui
/
tabcompleter.cpp
diff --git
a/gui/tabcompleter.cpp
b/gui/tabcompleter.cpp
index
c9a7860
..
5b3e97f
100644
(file)
--- a/
gui/tabcompleter.cpp
+++ b/
gui/tabcompleter.cpp
@@
-23,6
+23,7
@@
TabCompleter::TabCompleter(QLineEdit *l, QObject *parent) : QObject(parent) {
lineEdit = l;
enabled = false;
TabCompleter::TabCompleter(QLineEdit *l, QObject *parent) : QObject(parent) {
lineEdit = l;
enabled = false;
+ startOfLineSuffix = QString(": "); // TODO make start of line suffix configurable
}
void TabCompleter::updateNickList(QStringList l) {
}
void TabCompleter::updateNickList(QStringList l) {
@@
-30,7
+31,7
@@
void TabCompleter::updateNickList(QStringList l) {
}
void TabCompleter::updateChannelList(QStringList l) {
}
void TabCompleter::updateChannelList(QStringList l) {
-
+ channelList = l;
}
void TabCompleter::buildCompletionList() {
}
void TabCompleter::buildCompletionList() {
@@
-58,10
+59,22
@@
void TabCompleter::complete() {
for (int i = 0; i < lastCompletionLength; i++) {
lineEdit->backspace();
}
for (int i = 0; i < lastCompletionLength; i++) {
lineEdit->backspace();
}
- lineEdit->insert(*nextCompletion + ' ');
- lastCompletionLength = nextCompletion->length() + 1;
+
+ // insert completion
+ lineEdit->insert(*nextCompletion);
+
+ // remember charcount to delete next time and advance to next completion
+ lastCompletionLength = nextCompletion->length();
nextCompletion++;
nextCompletion++;
- } else if (completionList.begin() != completionList.end()) {
+
+ // we're completing the first word of the line
+ if(lineEdit->text().length() == lastCompletionLength) {
+ lineEdit->insert(startOfLineSuffix);
+ lastCompletionLength += 2;
+ }
+
+ // we're at the end of the list -> start over again
+ } else {
nextCompletion = completionList.begin();
}
nextCompletion = completionList.begin();
}