-
Notifications
You must be signed in to change notification settings - Fork 292
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
Conversation
|
@anthonykim1 Gonna add the ioctl's for TIOCGWINSZ/TIOCSWINSZ to the node-termios package, then you don't have to shim it with your own C helper. |
|
@jerch we don't use that atm though and want to avoid including dev dependencies in general? |
|
@Tyriar No need to include into the automated CI testing. It is more helpful for exploring local tests as @anthonykim1 did above and would spare the need to go into C yourself (so it would help any JS/TS dev without any C experience). |
|
@anthonykim1 The new package is online now: https://www.npmjs.com/package/node-termios/v/0.2.0 With it you can create a console app in nodejs tracking the TTY size like this: const { native: { tcgetwinsize } } = require('node-termios');
// file descriptor of STDIN
const STDIN_FD = 0;
// needed to keep the process running
// (not needed if you keep the event loop running by other means)
process.stdin.resume();
// register a signal handler for SIGWINCH
process.on('SIGWINCH', () => {
console.log('TTY size:', tcgetwinsize(STDIN_FD));
});and then resizing the terminal window. This works only under macos/linux though (prolly also under FreeBSD, Solaris is untested). |



From: xtermjs/xterm.js#5619 (comment)