From 53a19c2809d2596b6de756c5faaac434915d61b9 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Tue, 15 Sep 2020 11:10:18 +0200 Subject: [PATCH] [#30] Make isIncompleteInput pluggable --- lib/LocalEchoController.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/LocalEchoController.js b/lib/LocalEchoController.js index b2212a2..28ff94e 100644 --- a/lib/LocalEchoController.js +++ b/lib/LocalEchoController.js @@ -26,10 +26,11 @@ export default class LocalEchoController { constructor(term = null, options = {}) { this.term = term; this._handleTermData = this.handleTermData.bind(this); - this._handleTermResize = this.handleTermResize.bind(this) - + this._handleTermResize = this.handleTermResize.bind(this); + this.history = new HistoryController(options.historySize || 10); this.maxAutocompleteEntries = options.maxAutocompleteEntries || 100; + this.isIncompleteInput = options.isIncompleteInput || isIncompleteInput; this._autocompleteHandlers = []; this._active = false; @@ -43,7 +44,6 @@ export default class LocalEchoController { }; this._disposables = []; - if (term) { if (term.loadAddon) term.loadAddon(this); else this.attach(); @@ -545,7 +545,7 @@ export default class LocalEchoController { } else if (ord < 32 || ord === 0x7f) { switch (data) { case "\r": // ENTER - if (isIncompleteInput(this._input)) { + if (this.isIncompleteInput(this._input)) { this.handleCursorInsert("\n"); } else { this.handleReadComplete();