Skip to content

Commit 460e71d

Browse files
authored
Merge pull request #237 from JunoLab/sp/terminalfixes
Fix terminals on newer Windows versions
2 parents e1e3074 + 70f0272 commit 460e71d

File tree

3 files changed

+23
-30
lines changed

3 files changed

+23
-30
lines changed

lib/console/console.js

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,6 @@ export default class InkTerminal extends PaneItem {
178178
this.ty = ty
179179

180180
this.onData = this.terminal.onData(data => this.ty.write(data))
181-
this.onResize = this.terminal.onResize(size => {
182-
if (this.ty && this.ty.resize) {
183-
this.ty.resize(size.cols, size.rows)
184-
}
185-
})
186-
187181
this.ty.on('data', data => this.terminal.write(data.toString()))
188182

189183
if (this.element.parentElement) {
@@ -199,10 +193,6 @@ export default class InkTerminal extends PaneItem {
199193
this.onData.dispose()
200194
this.onData = undefined
201195
}
202-
if (this.onResize != undefined) {
203-
this.onResize.dispose()
204-
this.onResize = undefined
205-
}
206196

207197
if (keepTy) this.ty.destroy()
208198

@@ -219,11 +209,14 @@ export default class InkTerminal extends PaneItem {
219209
}
220210

221211
resize () {
222-
const {cols, rows} = this.fitAddon.proposeDimensions()
223-
// 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
224215
if (this.terminal && !isNaN(cols) && !isNaN(rows)) {
225-
this.terminal.resize(cols - 2, rows)
226-
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+
}
227220
}
228221
}
229222

package-lock.json

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
"katex": "0.11.0",
2525
"replace-in-file": "^3.0.0",
2626
"underscore-plus": "^1.6.6",
27-
"xterm": "4.0.0",
28-
"xterm-addon-fit": "^0.2.0",
29-
"xterm-addon-search": "^0.2.0",
30-
"xterm-addon-web-links": "^0.2.0"
27+
"xterm": "4.2.0",
28+
"xterm-addon-fit": "^0.3.0",
29+
"xterm-addon-search": "^0.3.0",
30+
"xterm-addon-web-links": "^0.2.1"
3131
},
3232
"scripts": {
3333
"postinstall": "node scripts/postinstall.js"

0 commit comments

Comments
 (0)