Skip to content

Commit

Permalink
Ensure terminal rows and cols are always >= 1
Browse files Browse the repository at this point in the history
Fixes #35117
  • Loading branch information
Tyriar committed Sep 27, 2017
1 parent 0c90b53 commit ace4220
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export class TerminalInstance implements ITerminalInstance {
const scaledSpaceAvailable = dimension.height * window.devicePixelRatio;
const scaledCharHeight = Math.ceil(font.charHeight * window.devicePixelRatio);
const scaledLineHeight = Math.floor(scaledCharHeight * font.lineHeight);
this._rows = Math.floor(scaledSpaceAvailable / scaledLineHeight);
this._rows = Math.max(Math.floor(scaledSpaceAvailable / scaledLineHeight), 1);

return dimension.width;
}
Expand Down
4 changes: 3 additions & 1 deletion src/vs/workbench/parts/terminal/node/terminalProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ process.on('message', function (message) {
if (message.event === 'input') {
ptyProcess.write(message.data);
} else if (message.event === 'resize') {
ptyProcess.resize(message.cols, message.rows);
// Ensure that cols and rows are always >= 1, this prevents a native
// exception in winpty.
ptyProcess.resize(Math.max(message.cols, 1), Math.max(message.rows, 1));
} else if (message.event === 'shutdown') {
queueProcessExit();
}
Expand Down

0 comments on commit ace4220

Please sign in to comment.