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}
|
opts = opts || {stdout:false}
|
||||||
|
|
||||||
this.redirectConsole( (str,prefix) => {
|
this.redirectConsole( (str,prefix) => {
|
||||||
let finalStr = opts.stdout ? "\n\r" : ""
|
let finalStr = "";
|
||||||
prefix = prefix ? prefix+' ' : ''
|
prefix = prefix ? prefix+' ' : ''
|
||||||
str.trim().split("\n").map( (line) => {
|
str.trim().split("\n").map( (line) => {
|
||||||
finalStr += `${opts.stdout ? '' : "\x1b[38;5;165m/dev/browser: \x1b[0m"}`+prefix+line+'\n'
|
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)
|
this.term.write(ch)
|
||||||
const reset = () => {
|
const reset = () => {
|
||||||
this.console = ""
|
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") ){
|
if( (ch == "\n" || ch == "\r") ){
|
||||||
try{
|
try{
|
||||||
|
this.term.write("\n\r")
|
||||||
if( this.console ) eval(this.console)
|
if( this.console ) eval(this.console)
|
||||||
reset()
|
reset()
|
||||||
}catch(e){
|
}catch(e){
|
||||||
|
|
Loading…
Reference in New Issue