Skip to content
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

Resize & fit causing input display incorrectly #3962

Closed
ZodiacWind opened this issue Jul 29, 2022 · 2 comments · Fixed by #3967
Closed

Resize & fit causing input display incorrectly #3962

ZodiacWind opened this issue Jul 29, 2022 · 2 comments · Fixed by #3967
Assignees
Labels
platform/windows type/bug Something is misbehaving
Milestone

Comments

@ZodiacWind
Copy link

ZodiacWind commented Jul 29, 2022

I used xterm-addon-fit to resize the terminal while the window size changing.

The terminal can resize normally. However, if there are multiple lines input, the current input cannot dispplay correctly:

  • If the window becomes larger, many spaces will be added to the tails input instead of filling with following lines.
  • If the window shrinks, the current input will be truncated and could not be recovered.

In addition, historical input can be displayed correctly.

Untitled video——使用Clipchamp制作 (1)
Untitled video——使用Clipchamp制作 (2)
Untitled video——使用Clipchamp制作 (3)

Details

  • Browser and browser version: Google Chrome 103.0.5060.134(
  • OS version: Windows 11 10.0.25163
  • xterm.js version: 4.20 beta 26

Steps to reproduce

  1. Please refer to the code: https://codesandbox.io/s/xtermreact-demo-forked-o5n04u to reproduce it.
@Tyriar
Copy link
Member

Tyriar commented Jul 30, 2022

The resize behavior on Windows is a little special. First there is this option which should be used when using a Windows pty:

xterm.js/typings/xterm.d.ts

Lines 210 to 220 in a8f63c4

/**
* Whether "Windows mode" is enabled. Because Windows backends winpty and
* conpty operate by doing line wrapping on their side, xterm.js does not
* have access to wrapped lines. When Windows mode is enabled the following
* changes will be in effect:
*
* - Reflow is disabled.
* - Lines are assumed to be wrapped if the last character of the line is
* not whitespace.
*/
windowsMode?: boolean;

This actually disables reflow completely as conpty handles resize instead of the terminal. This is fixed for the most part on recent versions of Windows 11 because of: microsoft/terminal#405

This is how VS Code behaves on Windows 11 21H2 (v22000.795):

Recording 2022-07-30 at 06 22 19

VS Code only enables windowsMode on Windows < v21376:

https://github.com/microsoft/vscode/blob/e62392c1b91d9e56c2af6257a8f32bd6d0fdf295/src/vs/platform/terminal/node/terminalProcess.ts#L397

I'll add a comment to windowsMode about the recommended version.

@Tyriar Tyriar added type/bug Something is misbehaving platform/windows labels Jul 30, 2022
@Tyriar Tyriar added this to the 5.0.0 milestone Jul 30, 2022
@Tyriar Tyriar self-assigned this Jul 30, 2022
Tyriar added a commit to Tyriar/xterm.js that referenced this issue Jul 30, 2022
@ZodiacWind
Copy link
Author

Thanks for your reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform/windows type/bug Something is misbehaving
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants