better linebreaks for javascript console
This commit is contained in:
parent
1de711f358
commit
e707820915
|
@ -34,7 +34,7 @@ ISOTerminal.prototype.enableConsole = function(opts){
|
|||
opts = opts || {stdout:false}
|
||||
|
||||
this.redirectConsole( (str,prefix) => {
|
||||
let finalStr = opts.stdout ? "\n\r" : ""
|
||||
let finalStr = "";
|
||||
prefix = prefix ? prefix+' ' : ''
|
||||
str.trim().split("\n").map( (line) => {
|
||||
finalStr += `${opts.stdout ? '' : "\x1b[38;5;165m/dev/browser: \x1b[0m"}`+prefix+line+'\n'
|
||||
|
|
|
@ -103,10 +103,11 @@ ISOTerminal.prototype.TermInit = function(){
|
|||
this.term.write(ch)
|
||||
const reset = () => {
|
||||
this.console = ""
|
||||
setTimeout( () => this.term.write( this.term.prompt),100)
|
||||
setTimeout( () => "\n\r"+this.term.write( this.term.prompt),100)
|
||||
}
|
||||
if( (ch == "\n" || ch == "\r") ){
|
||||
try{
|
||||
this.term.write("\n\r")
|
||||
if( this.console ) eval(this.console)
|
||||
reset()
|
||||
}catch(e){
|
||||
|
|
Loading…
Reference in New Issue