sqlx-cli: read confirmation as a plain line, not a raw-mode toggle#4268
Open
c-tonneslan wants to merge 1 commit into
Open
sqlx-cli: read confirmation as a plain line, not a raw-mode toggle#4268c-tonneslan wants to merge 1 commit into
c-tonneslan wants to merge 1 commit into
Conversation
ask_to_continue_drop used dialoguer::Confirm with wait_for_newline(true). Even in that mode dialoguer still puts the terminal into raw input for the Y/N toggle, which is why: * keystrokes never echo, * the whole prompt gets repainted every time the default flips from [Y/n] to [y/N], looking like an infinite loop on narrow terminals, * screen-reader users get hammered with the same long line over and over, with no audible cue that the keypress registered. A blocking stdin().read_line() does the right thing here: input echoes as you'd expect, the prompt is printed once, and the (y/N) hint stays visible. The --force/-y and non-TTY paths are unchanged. dialoguer was the only thing pulling in raw-mode input on this code path, so drop the dep and the now-stale Term::show_cursor guard along with it. Closes launchbadge#4236 Signed-off-by: Charlie Tonneslan <cst0520@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4236.
ask_to_continue_dropusesdialoguer::Confirmwithwait_for_newline(true). Even in that mode dialoguer still puts the terminal into raw input for the Y/N toggle, which is why:[Y/n]to[y/N], looking like an infinite loop on narrow terminals,A blocking
stdin().read_line()does the right thing here: input echoes the way users expect, the prompt is printed once, and the(y/N)hint stays visible. The--force/-y/ non-TTY paths are unchanged.dialoguerwas the only thing pulling in raw-mode input on this code path, so dropped the dep and the now-staleTerm::show_cursorguard along with it.Built
sqlx-clilocally with--no-default-features --features sqlite; manualsqlx database dropagainst a sqlite URL behaves as you'd expect — prompt prints, key echoes, Enter confirms.