+bool InputLine::addToHistory(const QString &text) {
+ if(text.isEmpty())
+ return false;
+
+ Q_ASSERT(0 <= idx && idx <= history.count());
+
+ if(history.isEmpty() || text != history[idx - (int)(idx == history.count())]) {
+ // if we change an entry of the history the changed entry is appended to the list and we seek to the end
+ // we could also easily change the entry in the history... per setting maybe?
+ history << text;
+ idx = history.count();
+ return true;
+ } else {
+ return false;
+ }