From 1fe63561a81290c8afd3afc47674402194d9651d Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Sat, 6 Dec 2014 09:02:06 +0200 Subject: completer: hide unless 1 or more elements; Fixes #185 --- index.html | 2 +- src/view/completer.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index efb3e556..81c7491c 100644 --- a/index.html +++ b/index.html @@ -47,7 +47,7 @@ -
+
diff --git a/src/view/completer.js b/src/view/completer.js index 7cf20d05..675774d8 100644 --- a/src/view/completer.js +++ b/src/view/completer.js @@ -68,6 +68,7 @@ var completer = (function (input_element, dropdown) { var hash = text.slice(0, cursor).lastIndexOf(triggerStart); // TODO check if current completion has been invalidated _invalidateSelection(); + dropdown.hide(); dropdown_raw.innerHTML = ""; // remove all elements if (hash == -1) { return; @@ -87,6 +88,9 @@ var completer = (function (input_element, dropdown) { }); completion_start = hash + 1; completion_end = space; + if (dropdown.children().length > 0) { + dropdown.show(); + } } function _invalidateSelection() { -- cgit v1.3.1