diff --git a/krunner/view.cpp b/krunner/view.cpp --- a/krunner/view.cpp +++ b/krunner/view.cpp @@ -354,14 +354,23 @@ void View::addToHistory(const QString &item) { + if (item.isEmpty()) { + return; + } + if (item == QLatin1String("SESSIONS")) { return; } if (!KAuthorized::authorize(QStringLiteral("lineedit_text_completion"))) { return; } + // Mimic shell behavior of not storing lines starting with a space + if (item.at(0).isSpace()) { + return; + } + m_history.removeOne(item); m_history.prepend(item);