improved REPL performance
This commit is contained in:
parent
9698cafefd
commit
9579bf7215
4 changed files with 18 additions and 32 deletions
|
|
@ -94,35 +94,13 @@ ISOTerminal.addEventListener('init', function(){
|
||||||
this.send(this.prompt)
|
this.send(this.prompt)
|
||||||
}, 100 )
|
}, 100 )
|
||||||
},
|
},
|
||||||
keyHandler: function(ch){
|
keyHandler: function(ch){
|
||||||
let erase = false
|
|
||||||
// if( ch == '\x7F' ){
|
|
||||||
// ch = "\b \b" // why does write() not just support \x7F ?
|
|
||||||
// erase = true
|
|
||||||
// }
|
|
||||||
this.send(ch)
|
this.send(ch)
|
||||||
const reset = () => {
|
},
|
||||||
this.console = ""
|
cmdHandler: function(cmd){
|
||||||
setTimeout( () => {
|
this.send("\n\r")
|
||||||
if( this.boot.menu.selected ) this.send(this.prompt)
|
eval(cmd)
|
||||||
},100)
|
setTimeout( () => this.send(this.prompt) ,10) // because worker vs terminal
|
||||||
}
|
|
||||||
if( (ch == "\n" || ch == "\r") ){
|
|
||||||
try{
|
|
||||||
this.send("\n\r")
|
|
||||||
if( this.console ) eval(this.console)
|
|
||||||
reset()
|
|
||||||
}catch(e){
|
|
||||||
reset()
|
|
||||||
throw e // re throw
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
if( erase ){
|
|
||||||
this.console = this.console.split('').slice(0,-1).join('')
|
|
||||||
}else{
|
|
||||||
this.console += ch
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -78,15 +78,18 @@ ISOTerminal.prototype.TermInit = function(){
|
||||||
erase = true
|
erase = true
|
||||||
}
|
}
|
||||||
if( this.boot.menu.selected ){
|
if( this.boot.menu.selected ){
|
||||||
|
this.boot.menu.selected.keyHandler.call(this,ch)
|
||||||
if( isEnter ){
|
if( isEnter ){
|
||||||
this.boot.menu.selected.cmdHandler.call(this,this.lastCmd)
|
if( this.boot.menu.selected.cmdHandler ){
|
||||||
|
this.boot.menu.selected.cmdHandler.call(this,this.lastCmd)
|
||||||
|
}
|
||||||
this.lastCmd = ""
|
this.lastCmd = ""
|
||||||
}
|
}
|
||||||
else this.boot.menu.selected.keyHandler.call(this,ch)
|
|
||||||
}else if( isEnter ){
|
}else if( isEnter ){
|
||||||
let menuitem = this.boot.menu.find( (m) => m.key == this.lastChar )
|
let menuitem = this.boot.menu.find( (m) => m.key == this.lastChar )
|
||||||
if( menuitem ){
|
if( menuitem ){
|
||||||
this.boot.menu.selected = menuitem
|
this.boot.menu.selected = menuitem
|
||||||
|
this.lastCmd = ""
|
||||||
menuitem.init.call(this, () => {
|
menuitem.init.call(this, () => {
|
||||||
this.term.write("\n\r")
|
this.term.write("\n\r")
|
||||||
this.bootMenu()
|
this.bootMenu()
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
|
||||||
|
;
|
||||||
(function (three) {
|
(function (three) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
@ -676,4 +678,5 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
})(THREE);
|
})(THREE);
|
||||||
//# sourceMappingURL=aframe-html.js.map
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -116,9 +116,11 @@ AFRAME.registerComponent('window', {
|
||||||
})
|
})
|
||||||
|
|
||||||
AFRAME.utils.positionObjectNextToNeighbor = function positionObjectNextToNeighbor(object, lastNeighbor = null, margin ){
|
AFRAME.utils.positionObjectNextToNeighbor = function positionObjectNextToNeighbor(object, lastNeighbor = null, margin ){
|
||||||
|
if( lastNeighbor == null || object == null) return
|
||||||
// *FIXME* this could be more sophisticated :)
|
// *FIXME* this could be more sophisticated :)
|
||||||
object.position.x = lastNeighbor.position.x + margin
|
object.position.x = lastNeighbor.position.x + margin
|
||||||
object.position.y = lastNeighbor.position.y - margin
|
object.position.y = lastNeighbor.position.y - margin
|
||||||
object.position.z = lastNeighbor.position.z + margin
|
object.position.z = lastNeighbor.position.z + margin
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue