@@ -60,6 +60,9 @@ export default class InkTerminal extends PaneItem {
60
60
if ( item instanceof InkTerminal ) {
61
61
item . view . initialize ( item )
62
62
item . terminal . focus ( )
63
+ if ( item . ty ) {
64
+ item . resize ( )
65
+ }
63
66
}
64
67
} ) )
65
68
}
@@ -175,12 +178,6 @@ export default class InkTerminal extends PaneItem {
175
178
this . ty = ty
176
179
177
180
this . onData = this . terminal . onData ( data => this . ty . write ( data ) )
178
- this . onResize = this . terminal . onResize ( size => {
179
- if ( this . ty && this . ty . resize ) {
180
- this . ty . resize ( size . cols , size . rows )
181
- }
182
- } )
183
-
184
181
this . ty . on ( 'data' , data => this . terminal . write ( data . toString ( ) ) )
185
182
186
183
if ( this . element . parentElement ) {
@@ -196,10 +193,6 @@ export default class InkTerminal extends PaneItem {
196
193
this . onData . dispose ( )
197
194
this . onData = undefined
198
195
}
199
- if ( this . onResize != undefined ) {
200
- this . onResize . dispose ( )
201
- this . onResize = undefined
202
- }
203
196
204
197
if ( keepTy ) this . ty . destroy ( )
205
198
@@ -216,11 +209,14 @@ export default class InkTerminal extends PaneItem {
216
209
}
217
210
218
211
resize ( ) {
219
- const { cols, rows} = this . fitAddon . proposeDimensions ( )
220
- // resize twice with different sizes to actually force a resize:
212
+ let { cols, rows} = this . fitAddon . proposeDimensions ( )
213
+ // slightly narrower terminal looks better:
214
+ cols -= 1
221
215
if ( this . terminal && ! isNaN ( cols ) && ! isNaN ( rows ) ) {
222
- this . terminal . resize ( cols - 2 , rows )
223
- this . terminal . resize ( cols - 1 , rows )
216
+ this . terminal . resize ( cols , rows )
217
+ if ( this . ty && this . ty . resize ) {
218
+ this . ty . resize ( cols , rows )
219
+ }
224
220
}
225
221
}
226
222
0 commit comments