about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tools/history.c4
-rw-r--r--src/ui/inputwin.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/src/tools/history.c b/src/tools/history.c
index 5ac41969..b80a9555 100644
--- a/src/tools/history.c
+++ b/src/tools/history.c
@@ -146,6 +146,10 @@ history_next(History history, char *item)
         return NULL;
     }
 
+    if (g_list_next(history->session.sess_curr) == NULL) {
+        return NULL;
+    }
+
     char *copied = "";
     if (item != NULL) {
         copied = strdup(item);
diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c
index 3f3d2ab5..feb4a0ba 100644
--- a/src/ui/inputwin.c
+++ b/src/ui/inputwin.c
@@ -490,6 +490,10 @@ _handle_edit(int result, const wint_t ch, char *input, int *size)
             next = cmd_history_next(input, size);
             if (next) {
                 inp_replace_input(input, next, size);
+            } else if (*size != 0) {
+                input[*size] = '\0';
+                cmd_history_append(input);
+                inp_replace_input(input, "", size);
             }
             return 1;