better linebreaks for javascript console
/ mirror_to_github (push) Successful in 23s Details
/ test (push) Successful in 4s Details

This commit is contained in:
Leon van Kammen 2025-01-15 23:03:57 +01:00
parent 1de711f358
commit e707820915
2 changed files with 3 additions and 2 deletions

View File

@ -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'

View File

@ -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){