From 80fc25c6a4f976470ec01568e72e31dcec88dfcd Mon Sep 17 00:00:00 2001 From: Guillermo Rauch Date: Thu, 7 Jul 2016 08:53:23 -0700 Subject: [PATCH] make term configurable --- app/hyperterm.js | 5 +++++ app/term.js | 52 ++++++++++++++++++++++++------------------------ 2 files changed, 31 insertions(+), 26 deletions(-) diff --git a/app/hyperterm.js b/app/hyperterm.js index a0255b11..12641d79 100644 --- a/app/hyperterm.js +++ b/app/hyperterm.js @@ -84,6 +84,7 @@ export default class HyperTerm extends Component { ref='termWrapper'>{ this.state.sessions.map((uid, i) => { const active = i === this.state.active; + const { config } = this.props; return
{ const io = this.term.io.push(); io.onVTKeystroke = io.sendString = (str) => { - this.props.onData(str); + props.onData(str); }; io.onTerminalResize = (cols, rows) => { - this.props.onResize({ cols, rows }); + props.onResize({ cols, rows }); }; }; this.term.decorate(this.refs.term); @@ -112,6 +96,22 @@ export default class Term extends Component { if (this.props.fontSize !== nextProps.fontSize) { this.term.prefs_.set('font-size', nextProps.fontSize); } + + if (this.props.backgroundColor !== nextProps.backgroundColor) { + this.term.prefs_.set('background-color', nextProps.backgroundColor); + } + + if (this.props.fontFamily !== nextProps.fontFamily) { + this.term.prefs_.set('font-family', nextProps.fontFamily); + } + + if (this.props.cursorColor !== nextProps.cursorColor) { + this.term.prefs_.set('cursor-color', nextProps.cursorColor); + } + + if (this.props.colors.toString() !== nextProps.colors.toString()) { + this.term.prefs_.set('color-palette-overrides', nextProps.colors); + } } shouldComponentUpdate (nextProps) {