Keyboard input on Windows gets garbled if you alt-Tab
Author: pfmooreCreated Aug 11, 2020Updated Sep 23, 2026
Labelsreadline
Behaviour of keyboard input is corrupted on Windows if you alt-Tab out of the console window you are using and then back.
To reproduce:
- Start usql
- Once the (not connected) prompt appears, use Alt-Tab to switch to another window, and then back again.
- Type "create tab" - when you type the "b", the cursor moves back to under the "t" of "ta", rather than entering a "b" character.
It looks like usql has a keyboard shortcut of Alt-b, but using Alt-tab causes the program to think it's seen an alt keypress even though that key is no longer pressed.
From checking https://github.com/gohxs/readline (and the project it was forked from, https://github.com/chzyer/readline) it looks like that library is pretty buggy on Windows
Source: xo/usql