AlecAivazis / survey

A golang library for building interactive and accessible prompts with full support for windows and posix terminals.
MIT License
4.07k stars 350 forks source link

Fix bugs when deleting characters when prompt is at the bottom of the terminal #442

Closed pokir closed 1 year ago

pokir commented 1 year ago

This fixes #437 by checking if the cursor moved down a line before erasing the line.

When the terminal scrolls down after the text reaches the bottom of the terminal, no next line exists. So trying to move the cursor down one line just makes it go to the beginning of the same line. Erasing the line then erases the last line of text, making it invisible.

pokir commented 1 year ago

Also fixed a similar bug, where if there was only one character on the last line of the terminal and a character was deleted on a previous line, it wouldn't get erased.

Combined with the fix described above, removing the check for if cursorCurrent is before the last line fixed this.

AlecAivazis commented 1 year ago

👋 Thanks for submitting this! Please bear with us while we catch up on a lot of PRs that are piling up. We appreciate your patience

AlecAivazis commented 1 year ago

I'm going to close this since its gone a bit stale and I can't reproduce it.