-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
If the user has a command typed out that is approaching the width of the terminal and attempts to page through completions for an argument, an argument may be subbed in that causes the line to wrap (e.g. the prompt now takes n+1 lines), while tabbing away to a different suggested completion may cause the line to then unwrap (prompt goes back to n lines). Neither the prompt nor the pager are redrawn when this wrapping/unwrapping happens, so what's displayed in the tty emulator (apart from the selected completion's line which is redrawn) does not match the actual contents (off-by-one error). This causes corruption of the prompt regardless of whether a completion is ultimately chosen or which completion was chosen, leaving the terminal in a corrupted state (the prompt is broken up, incorrect, and scrolled out of view).
This doesn't happen under asciinema because the emulated TERM doesn't support our rich completions pager but here's a video capture:
2021-11-05-122427.mp4
You can see when the prompt first breaks (when the first too-long completion is selected) and if you look closely you can observe the oddities in the appearance of the selected item as I tab to and from the long completion. After the pager is closed (completion abandoned), I scroll up and you can see the detritus of the wrapping and unwrapping.