@@ -49,9 +49,6 @@ type ClassName = {
4949}
5050
5151interface Props extends ClassName {
52- /** Optional font size for terminal */
53- fontSize ?: number
54-
5552 /** If given, the initial terminal output to render */
5653 initialContent ?: string
5754
@@ -158,6 +155,9 @@ export default class XTerm extends React.PureComponent<Props, State> {
158155 Events . eventChannelUnsafe . on ( "/theme/change" , inject )
159156 this . cleaners . push ( ( ) => Events . eventChannelUnsafe . on ( "/theme/change" , inject ) )
160157
158+ Events . eventChannelUnsafe . on ( "/zoom" , inject )
159+ this . cleaners . push ( ( ) => Events . eventChannelUnsafe . off ( "/zoom" , inject ) )
160+
161161 if ( this . props . initialContent ) {
162162 // @starpit i don't know why we have to split the newlines...
163163 // versus: this.terminal.write(this.props.initialContent)
@@ -247,20 +247,16 @@ export default class XTerm extends React.PureComponent<Props, State> {
247247 xterm . setOption ( "fontFamily" , val ( "monospace" , "font" ) )
248248
249249 try {
250- const standIn = document . querySelector ( "body .repl .repl-input input " )
250+ const standIn = document . querySelector ( "body .repl" )
251251 if ( standIn ) {
252252 const fontTheme = getComputedStyle ( standIn )
253- xterm . setOption ( "fontSize" , this . props . fontSize || parseInt ( fontTheme . fontSize . replace ( / p x $ / , "" ) , 10 ) )
253+ xterm . setOption ( "fontSize" , parseInt ( fontTheme . fontSize . replace ( / p x $ / , "" ) , 10 ) )
254254 // terminal.setOption('lineHeight', )//parseInt(fontTheme.lineHeight.replace(/px$/, ''), 10))
255255
256256 // FIXME. not tied to theme
257257 xterm . setOption ( "fontWeight" , 400 )
258258 xterm . setOption ( "fontWeightBold" , 600 )
259259 }
260-
261- if ( this . props . fontSize ) {
262- xterm . setOption ( "fontSize" , this . props . fontSize )
263- }
264260 } catch ( err ) {
265261 console . error ( "Error setting terminal font size" , err )
266262 }
0 commit comments