From edb34144c7811fc6bebf006dab16b19bc5a06094 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCbschle-Schneider?= Date: Mon, 21 Jul 2014 15:35:53 +0100 Subject: [PATCH] Move current line into history when pressing down in input bar --- js/models.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/js/models.js b/js/models.js index c4a7770..07b78c3 100644 --- a/js/models.js +++ b/js/models.js @@ -167,7 +167,14 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter) }; var getHistoryDown = function(currentLine) { - if (historyPos < 0 || historyPos >= history.length) { + if (historyPos === history.length) { + // stash on history like weechat does + if (currentLine !== undefined && currentLine !== '') { + history.push(currentLine); + historyPos++; + } + return ''; + } else if (historyPos < 0 || historyPos > history.length) { // Can't go down from out of bounds or last message return currentLine; } else {