Skip to content

sqlx-cli: read confirmation as a plain line, not a raw-mode toggle#4268

Open
c-tonneslan wants to merge 1 commit into
launchbadge:mainfrom
c-tonneslan:fix/cli-drop-prompt-accessible
Open

sqlx-cli: read confirmation as a plain line, not a raw-mode toggle#4268
c-tonneslan wants to merge 1 commit into
launchbadge:mainfrom
c-tonneslan:fix/cli-drop-prompt-accessible

Conversation

@c-tonneslan
Copy link
Copy Markdown

Closes #4236.

ask_to_continue_drop uses 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 the way users expect, the prompt is printed once, and the (y/N) hint stays visible. The --force / -y / non-TTY paths are unchanged.

dialoguer was the only thing pulling in raw-mode input on this code path, so dropped the dep and the now-stale Term::show_cursor guard along with it.

Built sqlx-cli locally with --no-default-features --features sqlite; manual sqlx database drop against a sqlite URL behaves as you'd expect — prompt prints, key echoes, Enter confirms.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Accessibility: sqlx database drop prompt loop is disorienting for visually impaired users (no input echo, no indication that return is needed)

1 participant