-
Notifications
You must be signed in to change notification settings - Fork 291
Add pixel size support to resize() #881
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,7 @@ interface IUnixNative { | |
| fork(file: string, args: string[], parsedEnv: string[], cwd: string, cols: number, rows: number, uid: number, gid: number, useUtf8: boolean, helperPath: string, onExitCallback: (code: number, signal: number) => void): IUnixProcess; | ||
| open(cols: number, rows: number): IUnixOpenProcess; | ||
| process(fd: number, pty?: string): string; | ||
| resize(fd: number, cols: number, rows: number): void; | ||
| resize(fd: number, cols: number, rows: number, xPixel: number, yPixel: number): void; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought about renaming this to Maybe |
||
| } | ||
|
|
||
| interface IConptyProcess { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -543,20 +543,22 @@ Napi::Value PtyResize(const Napi::CallbackInfo& info) { | |
| Napi::Env env(info.Env()); | ||
| Napi::HandleScope scope(env); | ||
|
|
||
| if (info.Length() != 3 || | ||
| if (info.Length() != 5 || | ||
| !info[0].IsNumber() || | ||
| !info[1].IsNumber() || | ||
| !info[2].IsNumber()) { | ||
| throw Napi::Error::New(env, "Usage: pty.resize(fd, cols, rows)"); | ||
| !info[2].IsNumber() || | ||
| !info[3].IsNumber() || | ||
| !info[4].IsNumber()) { | ||
| throw Napi::Error::New(env, "Usage: pty.resize(fd, cols, rows, xPixel, yPixel)"); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
|
|
||
| int fd = info[0].As<Napi::Number>().Int32Value(); | ||
|
|
||
| struct winsize winp; | ||
| winp.ws_col = info[1].As<Napi::Number>().Int32Value(); | ||
| winp.ws_row = info[2].As<Napi::Number>().Int32Value(); | ||
| winp.ws_xpixel = 0; | ||
| winp.ws_ypixel = 0; | ||
| winp.ws_xpixel = info[3].As<Napi::Number>().Int32Value(); | ||
| winp.ws_ypixel = info[4].As<Napi::Number>().Int32Value(); | ||
|
|
||
| if (ioctl(fd, TIOCSWINSZ, &winp) == -1) { | ||
| switch (errno) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I just create another interface PixelSize which would have field
width, height?That way we can just say simply say
pixelSizehere.