Implement proper Windows redisplay on resize #42
Labels
bug
Something isn't working
display
help wanted
Extra attention is needed
terminal
windows
All things related to Windows systems
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:
The text was updated successfully, but these errors were encountered: