+bool InputLine::addToHistory(const QString &text, bool temporary) {
+ if(text.isEmpty())
+ return false;
+
+ Q_ASSERT(0 <= idx && idx <= history.count());
+
+ if(history.isEmpty() || text != history[idx - (int)(idx == history.count())]) {
+ // if an entry of the history is changed, we remember it and show it again at this
+ // position until a line was actually sent
+ // sent lines get appended to the history
+ if(temporary) {
+ tempHistory[idx] = text;
+ } else {
+ history << text;
+ tempHistory.clear();
+ }
+ return true;
+ } else {
+ return false;
+ }