Skip to content

Commit 879fed4

Browse files
committed
actual fix
1 parent 722293c commit 879fed4

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

lib/console/console.js

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ export default class InkTerminal extends PaneItem {
6060
if (item instanceof InkTerminal) {
6161
item.view.initialize(item)
6262
item.terminal.focus()
63+
if (item.ty) {
64+
item.resize()
65+
}
6366
}
6467
}))
6568
}
@@ -175,12 +178,6 @@ export default class InkTerminal extends PaneItem {
175178
this.ty = ty
176179

177180
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-
184181
this.ty.on('data', data => this.terminal.write(data.toString()))
185182

186183
if (this.element.parentElement) {
@@ -196,10 +193,6 @@ export default class InkTerminal extends PaneItem {
196193
this.onData.dispose()
197194
this.onData = undefined
198195
}
199-
if (this.onResize != undefined) {
200-
this.onResize.dispose()
201-
this.onResize = undefined
202-
}
203196

204197
if (keepTy) this.ty.destroy()
205198

@@ -216,11 +209,14 @@ export default class InkTerminal extends PaneItem {
216209
}
217210

218211
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
221215
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+
}
224220
}
225221
}
226222

0 commit comments

Comments
 (0)