diff --git a/src/uisupport/inputline.cpp b/src/uisupport/inputline.cpp
index 31ec399..25356f5 100644
--- a/src/uisupport/inputline.cpp
+++ b/src/uisupport/inputline.cpp
@@ -36,12 +36,27 @@ InputLine::~InputLine() {
 
 void InputLine::keyPressEvent(QKeyEvent * event) {
   if(event->key() == Qt::Key_Up) {
+    if(!text().isEmpty() && !history.isEmpty()) {
+      if(!history.contains(text())) {
+        history << text();
+        idx = history.count();
+        if(idx > 1) idx--;
+      }
+    }
     if(idx > 0) { idx--; setText(history[idx]); }
     event->accept();
   } else if(event->key() == Qt::Key_Down) {
     if(idx < history.count()) idx++;
     if(idx < history.count()) setText(history[idx]);
-    else setText("");
+    else {
+      if(!text().isEmpty()) {
+        if(history.isEmpty() || history.last() != text()) {
+          history << text();
+          idx = history.count();
+        }
+        setText("");
+      }
+    }
     event->accept();
   } else if(event->key() == Qt::Key_Select) {  // for Qtopia
     emit returnPressed();
@@ -53,8 +68,12 @@ void InputLine::keyPressEvent(QKeyEvent * event) {
 }
 
 void InputLine::on_returnPressed() {
-  history << text();
-  idx = history.count();
+  if(!text().isEmpty()) {
+    if(history.isEmpty() || history.last() != text()) {
+      history << text();
+      idx = history.count();
+    }
+  }
   emit sendText(text());
   clear();
 }
