Add a Command class; add Entry.getFillText()

getFillText() serves to decouple the text displayed in the auto-complete list
via getText() and the text actually filled into the box via getFillText(). This
allows us to display command + args on the list but only fill the command part.

A Command class has been added to provide some structure when extracting the
command name and args. Manually tested and it works.
This commit is contained in:
Kegan Dougal 2016-01-14 14:39:58 +00:00
parent 864d10f412
commit b67131f0c8
5 changed files with 86 additions and 49 deletions

View file

@ -95,7 +95,7 @@ class TabComplete {
*/
completeTo(entry) {
this.textArea.value = this._replaceWith(
entry.getText(), true, entry.getSuffix(this.isFirstWord)
entry.getFillText(), true, entry.getSuffix(this.isFirstWord)
);
this.stopTabCompleting();
// keep focus on the text area
@ -222,7 +222,7 @@ class TabComplete {
if (!this.inPassiveMode) {
// set textarea to this new value
this.textArea.value = this._replaceWith(
this.matchedList[this.currentIndex].getText(),
this.matchedList[this.currentIndex].getFillText(),
this.currentIndex !== 0, // don't suffix the original text!
this.matchedList[this.currentIndex].getSuffix(this.isFirstWord)
);