From 48ade37f8c5896a2b746edfb54819b1a62a594ab Mon Sep 17 00:00:00 2001 From: serapath Date: Wed, 16 Aug 2017 17:25:47 +0200 Subject: [PATCH] FIX small terminal issues --- src/app/panels/terminal.js | 50 +++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/src/app/panels/terminal.js b/src/app/panels/terminal.js index 41e6bfc745..5143266430 100644 --- a/src/app/panels/terminal.js +++ b/src/app/panels/terminal.js @@ -96,24 +96,24 @@ var css = csjs` } ` -var currentError - -window.addEventListener('error', function (event) { - currentError = new Error(event.message) - currentError.timeStamp = event.timeStamp - currentError.isTrusted = event.isTrusted - currentError.filename = event.filename - currentError.lineno = event.lineno - currentError.colno = event.colno - currentError.error = event.error - currentError.type = event.type -}) - -window.onerror = function (msg, url, lineno, col, error) { - if (!error) error = currentError - var val = { msg: msg, url: url, lineno: lineno, col: col, error: error } - console.error(val) -} +// var currentError +// +// window.addEventListener('error', function (event) { +// currentError = new Error(event.message) +// currentError.timeStamp = event.timeStamp +// currentError.isTrusted = event.isTrusted +// currentError.filename = event.filename +// currentError.lineno = event.lineno +// currentError.colno = event.colno +// currentError.error = event.error +// currentError.type = event.type +// }) +// +// window.onerror = function (msg, url, lineno, col, error) { +// if (!error) error = currentError +// var val = { msg: msg, url: url, lineno: lineno, col: col, error: error } +// console.error(val) +// } var KONSOLES = [] // var KONSOLES = [{ @@ -239,8 +239,7 @@ class Terminal { delete self.scroll2bottom // @TODO: delete new message indicator } else { - // self.scroll2bottom = function () { } - // @TODO: the reattach is not working + self.scroll2bottom = function () { } // @TODO: while in stopped mode: show indicator about new lines getting logged } } @@ -338,6 +337,7 @@ class Terminal { var args = [].slice.call(arguments) var types = args.map(type) var values = javascriptserialize.apply(null, args).map(function (val, idx) { + if (typeof args[idx] === 'string') val = args[idx] if (types[idx] === 'element') val = jsbeautify.html(val) var pattern = '.{1,' + self.data.lineLength + '}' var lines = val.match(new RegExp(pattern, 'g')) @@ -374,6 +374,16 @@ class Terminal { }) }) } + info () { + var self = this + var args = [...arguments].map(x => ({ type: 'info', value: x })) + self.log.apply(self, args) + } + error () { + var self = this + var args = [...arguments].map(x => ({ type: 'error', value: x })) + self.log.apply(self, args) + } scroll2bottom () { var self = this setTimeout(function () {