Closed FormalSnake closed 2 years ago
Something doesn't seem right, I don't have time to look into this atm though.
You could try debug into this function to make sure it's calling terminal.resize as expected:
@superlopez-real Maybe I've overlooked it - where do you propagate the changed terminal size back to ptyProcess
?
@superlopez-real Maybe I've overlooked it - where do you propagate the changed terminal size back to
ptyProcess
?
I think that happens in the plugin
Something doesn't seem right, I don't have time to look into this atm though.
You could try debug into this function to make sure it's calling terminal.resize as expected:
Sure ill try it out
I've done it, i think, but it didn't do the console.log when resizing the window.
if (
this._terminal.rows !== dims.rows ||
this._terminal.cols !== dims.cols
) {
core._renderService.clear();
this._terminal.resize(dims.cols, dims.rows);
console.log("Resized terminal");
}
}
@superlopez-real Maybe I've overlooked it - where do you propagate the changed terminal size back to
ptyProcess
?I think that happens in the plugin
Nope, the plugin only deals with changes on terminal side. You still need to announce those changes back to the pty.
@superlopez-real Maybe I've overlooked it - where do you propagate the changed terminal size back to
ptyProcess
?I think that happens in the plugin
Nope, the plugin only deals with changes on terminal side. You still need to announce those changes back to the pty.
How would i do that?
This depends on how you connect to the server side. Untested:
// client side
term.onResize((size: { cols: number, rows: number }) => {
ipc.send("terminal.resize", size);
});
// server side
ipcMain.on("terminal.resize", (event, size) => {
ptyProcess.resize(size.cols, size.rows);
});
(Not sure, if that mangles the values correctly for server side, well you basically need to get those 2 int values over.)
This depends on how you connect to the server side. Untested:
// client side term.onResize((size: { cols: number, rows: number }) => { ipc.send("terminal.resize", size); }); // server side ipcMain.on("terminal.resize", (event, size) => { ptyProcess.resize(size.cols, size.rows); });
(Not sure, if that mangles the values correctly for server side, well you basically need to get those 2 int values over.)
I dont have a server side terminal, it is a custom terminal application for your own computer, but ill try it out.
This depends on how you connect to the server side. Untested:
// client side term.onResize((size: { cols: number, rows: number }) => { ipc.send("terminal.resize", size); }); // server side ipcMain.on("terminal.resize", (event, size) => { ptyProcess.resize(size.cols, size.rows); });
(Not sure, if that mangles the values correctly for server side, well you basically need to get those 2 int values over.)
How do i convert this to javascript? and where do i get the cols and rows from
I dont have a server side terminal, it is a custom terminal application for your own computer, but ill try it out.
You have a client-server application, your main.js
runs as server part and index.js
as client part. Thats the reason why have to use ipc messaging between (separate processes).
How do i convert this to javascript?
Thats almost javascript, just remove the type annotations of the client part.
and where do i get the cols and rows from
From the terminal onResize
event as shown above.
I dont have a server side terminal, it is a custom terminal application for your own computer, but ill try it out.
You have a client-server application, your
main.js
runs as server part andindex.js
as client part. Thats the reason why have to use ipc messaging between (separate processes).How do i convert this to javascript?
Thats almost javascript, just remove the type annotations of the client part.
and where do i get the cols and rows from
From the terminal
onResize
event as shown above.
oooh ok, ill try it out
ipcMain.on("terminal.resize", (event, size) => { ptyProcess.resize(size.cols, size.rows); });
YOU FIXED IT!! thanks a lot.
For anyone doing this in javascript, change
term.onResize((size: { cols: number, rows: number }) => {
ipc.send("terminal.resize", size);
});
to
term.onResize(function (size) {
ipc.send("terminal.resize", size);
});
Resizing my xterm window makes the content grow and shrink, as expected, but when i run vim or tmux, and then resize, it doesnt work at all.
Details
Steps to reproduce
https://user-images.githubusercontent.com/90651091/175765816-0662d0c2-3511-4511-bf11-950f3e1bddd5.mov
index.html
index.js
main.js
This is most of my source code, if you wonder why some variables seem to come from nothing, like the shell settings, i have a configuration system. In the configuration i also set initial rows and columns, and vim and tmux use that, instead of the newly updated ones.