xtermjs / xterm.js

A terminal for the web
https://xtermjs.org/
MIT License
16.99k stars 1.59k forks source link

Xterm.onResize cannot receive correct data #5053

Closed TheBlindM closed 1 month ago

TheBlindM commented 1 month ago

After calling fitAddon. fit(), the cols and rows received by "xterm. onResize" were not accurate. When I modified the window size and triggered fitAddon. fit() again, it worked fine

https://github.com/xtermjs/xterm.js/assets/48701152/c1b67ecf-743d-4ca3-9e18-b29a773e9df6

Before modifying window size: image

After modifying the window size image

Details

tisilent commented 1 month ago

It doesn't feel like it's a addon-fit issue. Print xterm.rows xterm.cols

TheBlindM commented 1 month ago

It doesn't feel like it's a addon-fit issue. Print xterm.rows xterm.cols

image

This type of offline only appears when the page is first accessed

tisilent commented 1 month ago

When executing fit(), the size of the parent element? Figure 1, it seems to be forcibly stretched.

TheBlindM commented 1 month ago

When executing fit(), the size of the parent element? Figure 1, it seems to be forcibly stretched.

The parent elements are all saturated, with normal width and height, but the onResize value is incorrect.