Open offensivelearning opened 1 year ago
Hey! I found an easy workaround, just decrement one row right here https://github.com/huashengdun/webssh/blob/master/webssh/static/js/main.js#L182
The line must look like this
var rows = parseInt(window.innerHeight / style.height, 10) - 1;
I think the issue only exists in chrome when in fullscreen
I have amend that line in the following file in my container:
/usr/local/lib/python3.8/site-packages/webssh/static/js/main.js
but it does nothing when in full screen
I have even tried decrementing more than 1 line and I still get the same issue in chrome - Firefox never had the issue
i think the section that needs to be amended is as follows:
function toggle_fullscreen(term) {
$('#terminal .terminal').toggleClass('fullscreen');
term.fitAddon.fit();
}
as I dont see the issue when I am not in full screen
Issue is present in both fullscreen and normal mode in Chrome 125 with webssh 1.6.2
The problem seems to be that when resize_terminal
is called the canvas hasn't been resized, so that the number of rows on the canvas is 1 and in the call to get_cell_size
the value term._core._renderService._renderer.dimensions.actualCellHeight
is an integer. If we resize once, reset the values style
and recall the resize slightly later the value of style.height will be a float. This completely puts off the calculation of the number of rows in current_geometry
.
The proof of the above is if a include the code
--- main.js.old 2024-10-17 09:33:12.000000000 +0000
+++ main.js 2024-11-04 13:27:32.031384764 +0000
@@ -187,6 +187,12 @@
function resize_terminal(term) {
var geometry = current_geometry(term);
term.on_resize(geometry.cols, geometry.rows);
+ setTimeout((term) => {
+ style.width = undefined;
+ style.height = undefined;
+ var geometry = current_geometry(term);
+ term.on_resize(geometry.cols, geometry.rows);
+ }, 100, term);
}
Then the issue is completely resolved. Not sure of the best way to really fix this issue, but this kludge does work. The delay of 100ms for the second resize might need to be different for others and so this fix is fragile, and something better is needed. I'm not enough of an expert of the webssh code base to propose something
This issue not being resolved is likely to make me dump webssh.
The display gets cut off towards the end as seen in the image. Happens on both Firefox and Chrome on Windows 11. Using WebSSH v 1.6.2.