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

Implement proper Windows redisplay on resize #42

Open
maxlandon opened this issue Jun 2, 2023 · 0 comments
Open

Implement proper Windows redisplay on resize #42

maxlandon opened this issue Jun 2, 2023 · 0 comments
Labels
bug Something isn't working display help wanted Extra attention is needed terminal windows All things related to Windows systems

Comments

@maxlandon
Copy link
Member

Resize events on Windows are sent through stdin.
The key-reader code in readline currently detects and notifies the display about them, correctly.

Problem

There is a bug that is only triggered when there is no autosuggested line to display for the current input buffer:
On resize event, the cursor is move at the end of the last line of completions, if any, and for no reason (no code in the display engine does such a move), which then causes the redisplay to start at the beginning of the last line of completions.

If there is an autosuggested line displayed at the moment of the resize event, the display handles the refresh just fine.

Attempts

There is commented out code in https://github.com/reeflective/readline/blob/master/internal/display/display_windows.go, which is an attempt at solving this by replacing the cursor back at the current input cursor position, before calling the engine to refresh itself. However this implementation is not stable, it does not work at times,
and it is ugly anyway.

Suspicions

At the first glance, I suspect Windows of introducting a weird behavior on this (which is here to move the cursor after the last non-empty character in the terminal buffer.
Therefore, help from someone with a better instinct and knowledge of Windows terminal internals would be greatly appreciated.

Related files:

@maxlandon maxlandon added bug Something isn't working help wanted Extra attention is needed terminal display windows All things related to Windows systems labels Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working display help wanted Extra attention is needed terminal windows All things related to Windows systems
Projects
None yet
Development

No branches or pull requests

1 participant