diff --git a/src/app/panels/terminal.js b/src/app/panels/terminal.js index 0d8f5c2826..0fa4f961f4 100644 --- a/src/app/panels/terminal.js +++ b/src/app/panels/terminal.js @@ -427,23 +427,29 @@ class Terminal { removeAutoComplete() } } else if (event.which === 38) { // - var len = self._cmdHistory.length - if (len === 0) return event.preventDefault() - if (self._cmdHistory.length - 1 > self._cmdIndex) { - self._cmdIndex++ + if (self._components.autoCompletePopup.data._options.length > self._components.autoCompletePopup._elementsToShow) { + self._components.autoCompletePopup._view.autoComplete.children[1].onclick(event) + } else { + var len = self._cmdHistory.length + if (len === 0) return event.preventDefault() + if (self._cmdHistory.length - 1 > self._cmdIndex) { + self._cmdIndex++ + } + self._view.input.innerText = self._cmdHistory[self._cmdIndex] + putCursor2End(self._view.input) + self.scroll2bottom() } - self._view.input.innerText = self._cmdHistory[self._cmdIndex] - putCursor2End(self._view.input) - self.scroll2bottom() - removeAutoComplete() } else if (event.which === 40) { // - if (self._cmdIndex > -1) { - self._cmdIndex-- + if (self._components.autoCompletePopup.data._options.length > self._components.autoCompletePopup._elementsToShow) { + self._components.autoCompletePopup._view.autoComplete.children[1].onclick(event) + } else { + if (self._cmdIndex > -1) { + self._cmdIndex-- + } + self._view.input.innerText = self._cmdIndex >= 0 ? self._cmdHistory[self._cmdIndex] : self._cmdTemp + putCursor2End(self._view.input) + self.scroll2bottom() } - self._view.input.innerText = self._cmdIndex >= 0 ? self._cmdHistory[self._cmdIndex] : self._cmdTemp - putCursor2End(self._view.input) - self.scroll2bottom() - removeAutoComplete() } else { self._cmdTemp = self._view.input.innerText } diff --git a/src/app/ui/auto-complete-popup.js b/src/app/ui/auto-complete-popup.js index 9b429e0d40..43c4d760c5 100644 --- a/src/app/ui/auto-complete-popup.js +++ b/src/app/ui/auto-complete-popup.js @@ -78,7 +78,7 @@ class AutoCompletePopup { } } function handleListIteration (event) { - if (event.srcElement.value === 'true') { + if (event.srcElement.value === 'true' || event.which === 40) { if ((self._startingElement + self._elementsToShow) < self.data._options.length) { self._startingElement += self._elementsToShow }