node-pty 1.2.0-beta.8 → 1.2.0-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -246,11 +246,14 @@ var UnixTerminal = /** @class */ (function (_super) {
246
246
  /**
247
247
  * TTY
248
248
  */
249
- UnixTerminal.prototype.resize = function (cols, rows) {
249
+ UnixTerminal.prototype.resize = function (cols, rows, pixelSize) {
250
+ var _a, _b;
250
251
  if (cols <= 0 || rows <= 0 || isNaN(cols) || isNaN(rows) || cols === Infinity || rows === Infinity) {
251
252
  throw new Error('resizing must be done using positive cols and rows');
252
253
  }
253
- pty.resize(this._fd, cols, rows);
254
+ var pixelWidth = (_a = pixelSize === null || pixelSize === void 0 ? void 0 : pixelSize.width) !== null && _a !== void 0 ? _a : 0;
255
+ var pixelHeight = (_b = pixelSize === null || pixelSize === void 0 ? void 0 : pixelSize.height) !== null && _b !== void 0 ? _b : 0;
256
+ pty.resize(this._fd, cols, rows, pixelWidth, pixelHeight);
254
257
  this._cols = cols;
255
258
  this._rows = rows;
256
259
  };
@@ -121,7 +121,7 @@ var WindowsTerminal = /** @class */ (function (_super) {
121
121
  /**
122
122
  * TTY
123
123
  */
124
- WindowsTerminal.prototype.resize = function (cols, rows) {
124
+ WindowsTerminal.prototype.resize = function (cols, rows, pixelSize) {
125
125
  var _this = this;
126
126
  if (cols <= 0 || rows <= 0 || isNaN(cols) || isNaN(rows) || cols === Infinity || rows === Infinity) {
127
127
  throw new Error('resizing must be done using positive cols and rows');
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "author": {
5
5
  "name": "Microsoft Corporation"
6
6
  },
7
- "version": "1.2.0-beta.8",
7
+ "version": "1.2.0-beta.9",
8
8
  "license": "MIT",
9
9
  "main": "./lib/index.js",
10
10
  "types": "./typings/node-pty.d.ts",
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/src/unix/pty.cc CHANGED
@@ -543,11 +543,13 @@ Napi::Value PtyResize(const Napi::CallbackInfo& info) {
543
543
  Napi::Env env(info.Env());
544
544
  Napi::HandleScope scope(env);
545
545
 
546
- if (info.Length() != 3 ||
546
+ if (info.Length() != 5 ||
547
547
  !info[0].IsNumber() ||
548
548
  !info[1].IsNumber() ||
549
- !info[2].IsNumber()) {
550
- throw Napi::Error::New(env, "Usage: pty.resize(fd, cols, rows)");
549
+ !info[2].IsNumber() ||
550
+ !info[3].IsNumber() ||
551
+ !info[4].IsNumber()) {
552
+ throw Napi::Error::New(env, "Usage: pty.resize(fd, cols, rows, xPixel, yPixel)");
551
553
  }
552
554
 
553
555
  int fd = info[0].As<Napi::Number>().Int32Value();
@@ -555,8 +557,8 @@ Napi::Value PtyResize(const Napi::CallbackInfo& info) {
555
557
  struct winsize winp;
556
558
  winp.ws_col = info[1].As<Napi::Number>().Int32Value();
557
559
  winp.ws_row = info[2].As<Napi::Number>().Int32Value();
558
- winp.ws_xpixel = 0;
559
- winp.ws_ypixel = 0;
560
+ winp.ws_xpixel = info[3].As<Napi::Number>().Int32Value();
561
+ winp.ws_ypixel = info[4].As<Napi::Number>().Int32Value();
560
562
 
561
563
  if (ioctl(fd, TIOCSWINSZ, &winp) == -1) {
562
564
  switch (errno) {
@@ -159,8 +159,11 @@ declare module 'node-pty' {
159
159
  * Resizes the dimensions of the pty.
160
160
  * @param columns The number of columns to use.
161
161
  * @param rows The number of rows to use.
162
+ * @param pixelSize Optional pixel dimensions of the pty. On Unix, this sets the `ws_xpixel`
163
+ * and `ws_ypixel` fields of the `winsize` struct. Applications running in the pty can read
164
+ * these values via the `TIOCGWINSZ` ioctl. This parameter is ignored on Windows.
162
165
  */
163
- resize(columns: number, rows: number): void;
166
+ resize(columns: number, rows: number, pixelSize?: { width: number, height: number }): void;
164
167
 
165
168
  /**
166
169
  * Clears the pty's internal representation of its buffer. This is a no-op