FIX small terminal issues

pull/1/head
serapath 7 years ago
parent 0fc681fc70
commit 48ade37f8c
  1. 50
      src/app/panels/terminal.js

@ -96,24 +96,24 @@ var css = csjs`
} }
` `
var currentError // var currentError
//
window.addEventListener('error', function (event) { // window.addEventListener('error', function (event) {
currentError = new Error(event.message) // currentError = new Error(event.message)
currentError.timeStamp = event.timeStamp // currentError.timeStamp = event.timeStamp
currentError.isTrusted = event.isTrusted // currentError.isTrusted = event.isTrusted
currentError.filename = event.filename // currentError.filename = event.filename
currentError.lineno = event.lineno // currentError.lineno = event.lineno
currentError.colno = event.colno // currentError.colno = event.colno
currentError.error = event.error // currentError.error = event.error
currentError.type = event.type // currentError.type = event.type
}) // })
//
window.onerror = function (msg, url, lineno, col, error) { // window.onerror = function (msg, url, lineno, col, error) {
if (!error) error = currentError // if (!error) error = currentError
var val = { msg: msg, url: url, lineno: lineno, col: col, error: error } // var val = { msg: msg, url: url, lineno: lineno, col: col, error: error }
console.error(val) // console.error(val)
} // }
var KONSOLES = [] var KONSOLES = []
// var KONSOLES = [{ // var KONSOLES = [{
@ -239,8 +239,7 @@ class Terminal {
delete self.scroll2bottom delete self.scroll2bottom
// @TODO: delete new message indicator // @TODO: delete new message indicator
} else { } else {
// self.scroll2bottom = function () { } self.scroll2bottom = function () { }
// @TODO: the reattach is not working
// @TODO: while in stopped mode: show indicator about new lines getting logged // @TODO: while in stopped mode: show indicator about new lines getting logged
} }
} }
@ -338,6 +337,7 @@ class Terminal {
var args = [].slice.call(arguments) var args = [].slice.call(arguments)
var types = args.map(type) var types = args.map(type)
var values = javascriptserialize.apply(null, args).map(function (val, idx) { 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) if (types[idx] === 'element') val = jsbeautify.html(val)
var pattern = '.{1,' + self.data.lineLength + '}' var pattern = '.{1,' + self.data.lineLength + '}'
var lines = val.match(new RegExp(pattern, 'g')) 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 () { scroll2bottom () {
var self = this var self = this
setTimeout(function () { setTimeout(function () {

Loading…
Cancel
Save