mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-10 02:13:58 +01:00
some usability improvement
This commit is contained in:
parent
7606240ad0
commit
f55ef264e4
1 changed files with 8 additions and 2 deletions
|
|
@ -6,6 +6,7 @@ export function Terminal(win, commandProcessor, variantsSupplier) {
|
|||
win.onShowCallback = function() {
|
||||
input.focus();
|
||||
};
|
||||
win.root.click(() => input.focus());
|
||||
this.history = [];
|
||||
this.historyPointer = 0;
|
||||
const setHistory = () => {
|
||||
|
|
@ -13,7 +14,6 @@ export function Terminal(win, commandProcessor, variantsSupplier) {
|
|||
input.val(this.history[this.historyPointer]);
|
||||
};
|
||||
|
||||
|
||||
input.keydown((e) => {
|
||||
function consumeEvent() {
|
||||
e.preventDefault();
|
||||
|
|
@ -41,6 +41,7 @@ export function Terminal(win, commandProcessor, variantsSupplier) {
|
|||
variants = variants.slice(0,limit);
|
||||
}
|
||||
autocompleteArea.text(variants.join(' ') + more);
|
||||
this.scrollToTheEnd();
|
||||
}
|
||||
}
|
||||
consumeEvent();
|
||||
|
|
@ -71,13 +72,18 @@ export function Terminal(win, commandProcessor, variantsSupplier) {
|
|||
}
|
||||
this.historyPointer = this.history.length;
|
||||
}
|
||||
this.out.parent().scrollTop(this.out.height());
|
||||
this.scrollToTheEnd();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Terminal.prototype.scrollToTheEnd = function() {
|
||||
this.out.parent().scrollTop(this.out.height());
|
||||
};
|
||||
|
||||
Terminal.prototype.print = function(text) {
|
||||
this.win.root.find('.terminal-output').append($('<div>', {text, 'class': 'terminal-commandResult'}));
|
||||
this.scrollToTheEnd();
|
||||
};
|
||||
|
||||
function sharedStartOfSortedArray(array){
|
||||
|
|
|
|||
Loading…
Reference in a new issue