From c6d5a130e4e46f0c2b1e4b563c29ffbee70c417e Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Sat, 18 Oct 2014 14:32:29 +0200 Subject: [PATCH] Fixed autocomplete resetting if list didn't change --- TODO | 1 - public_html/js/Controls/AutoCompleteInput.js | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index 80a76ae4..a517cfed 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,6 @@ This is transient file that lists functionalities to be implemented before first major release. -- autocomplete: don't reset active item if suggestions stay the same - autocomplete: don't show items that are already used in tag list (unsure) - posts/upload: when adding multiple files, select first one, not last one - posts/upload: better hotkeys for going to next post diff --git a/public_html/js/Controls/AutoCompleteInput.js b/public_html/js/Controls/AutoCompleteInput.js index 9bf4f644..d8e363ed 100644 --- a/public_html/js/Controls/AutoCompleteInput.js +++ b/public_html/js/Controls/AutoCompleteInput.js @@ -166,6 +166,7 @@ App.Controls.AutoCompleteInput = function($input) { } function updateResults(textToFind) { + var oldResults = results.slice(); var source = getSource(); var filter = getResultsFilter(textToFind); results = _.filter(source, filter); @@ -173,7 +174,9 @@ App.Controls.AutoCompleteInput = function($input) { results = options.additionalFilter(results); } results = results.slice(0, options.maxResults); - activeResult = -1; + if (!_.isEqual(oldResults, results)) { + activeResult = -1; + } } function applyAutocomplete() {