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

working vim in an ssh2 session, terminal screen does not update properly. #40

Closed
letsview opened this issue Jun 7, 2024 · 4 comments
Closed
Labels
bug Something isn't working

Comments

@letsview
Copy link

letsview commented Jun 7, 2024

Describe the bug
After working with vim in an ssh2 session and exiting, the terminal screen does not update properly.

To Reproduce
Steps to reproduce the behavior:

  1. Connect to other Linux with SSH2 session.
  2. Go to anywhere
  3. Exit after editing text file with VIM.
  4. Type 'Enter' command continuously on shell.

Expected behavior
The screen should be neatly updated.

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows10
  • Version V0.4.6

Additional context

@QQxiaoming QQxiaoming added the bug Something isn't working label Jun 8, 2024
@QQxiaoming
Copy link
Owner

I tried many times but failed to reproduce this issue. I guess it might be caused by broken window resize.
Have you tried to resize the window after this error occurs? What happens?

@QQxiaoming QQxiaoming added the question Further information is requested label Jun 11, 2024
QQxiaoming added a commit that referenced this issue Jun 11, 2024
Signed-off-by: xiaoming <2014500726@smail.xtu.edu.cn>
@letsview
Copy link
Author

The problem is solved by opening the text file with VIM and then adjusting the window size.
As shown in the following image, the size of the editing window when opening a document with VIM for the first time seems to be related.
image

@QQxiaoming
Copy link
Owner

QQxiaoming commented Jun 11, 2024

The problem is solved by opening the text file with VIM and then adjusting the window size. As shown in the following image, the size of the editing window when opening a document with VIM for the first time seems to be related. image

I think my latest commit ea773b2 may have fixed this issue. The original logic was to use a fixed terminal size of 80x24 after establishing the ssh connection, and resize sshpty according to the window size after 100ms. However, if the link establishment time is greater than 100ms, the resize will be ignored, resulting in the final size staying at 80x24, which is exactly the same as the situation in the screenshot. ea773b2 has now fixed this problem and will use the correct window size when initializing the connection.

Before,

int ret = libssh2_channel_request_pty_ex(m_sshChannel, "xterm", sizeof("xterm") - 1, nullptr, 0, 80, 24, 0, 0);

QTimer::singleShot(100, [=](){
shell->resize(term->columns(),term->lines());
});

Now,

int ret = libssh2_channel_request_pty_ex(m_sshChannel, "xterm", sizeof("xterm") - 1, nullptr, 0, m_cols, m_rows, 0, 0);

If you are interested you can try the artifacts in the github action workflow, or wait for my next release. Thank you for your contributions to make quardCRT better!

@QQxiaoming QQxiaoming removed the question Further information is requested label Jun 12, 2024
@QQxiaoming
Copy link
Owner

V0.4.7 is now available, which should resolve this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants