From: Manuel Nickschas Date: Fri, 8 May 2009 21:15:42 +0000 (+0200) Subject: Make behavior of input line history a bit more intuitive X-Git-Tag: 0.5-rc1~200 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=e1997b582c3ad73c4ff02f2b0167defb864db0a6 Make behavior of input line history a bit more intuitive Pressing enter will append the current text to the input line history even if an earlier entry was selected before. This is the behavior in any shell known to man, thus expected :) Finally closes #655. --- diff --git a/src/uisupport/inputline.cpp b/src/uisupport/inputline.cpp index 48ffa0a3..94dc5e91 100644 --- a/src/uisupport/inputline.cpp +++ b/src/uisupport/inputline.cpp @@ -162,20 +162,22 @@ bool InputLine::addToHistory(const QString &text, bool temporary) { Q_ASSERT(0 <= idx && idx <= history.count()); - if(history.isEmpty() || text != history[idx - (int)(idx == history.count())]) { + if(temporary) { // 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) { + if(history.isEmpty() || text != history[idx - (int)(idx == history.count())]) { tempHistory[idx] = text; - } else { + return true; + } + } else { + if(history.isEmpty() || text != history.last()) { history << text; tempHistory.clear(); + return true; } - return true; - } else { - return false; } + return false; } void InputLine::on_returnPressed() {