Issue#1462: Added directional keys list iteration

pull/3094/head
PaddyMc 6 years ago committed by Rob Stupay
parent b7106cb2da
commit 59f47b19c8
  1. 34
      src/app/panels/terminal.js
  2. 2
      src/app/ui/auto-complete-popup.js

@ -427,23 +427,29 @@ class Terminal {
removeAutoComplete() removeAutoComplete()
} }
} else if (event.which === 38) { // <arrowUp> } else if (event.which === 38) { // <arrowUp>
var len = self._cmdHistory.length if (self._components.autoCompletePopup.data._options.length > self._components.autoCompletePopup._elementsToShow) {
if (len === 0) return event.preventDefault() self._components.autoCompletePopup._view.autoComplete.children[1].onclick(event)
if (self._cmdHistory.length - 1 > self._cmdIndex) { } else {
self._cmdIndex++ 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) { // <arrowDown> } else if (event.which === 40) { // <arrowDown>
if (self._cmdIndex > -1) { if (self._components.autoCompletePopup.data._options.length > self._components.autoCompletePopup._elementsToShow) {
self._cmdIndex-- 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 { } else {
self._cmdTemp = self._view.input.innerText self._cmdTemp = self._view.input.innerText
} }

@ -78,7 +78,7 @@ class AutoCompletePopup {
} }
} }
function handleListIteration (event) { 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) { if ((self._startingElement + self._elementsToShow) < self.data._options.length) {
self._startingElement += self._elementsToShow self._startingElement += self._elementsToShow
} }

Loading…
Cancel
Save