less icon indicating copy to clipboard operation
less copied to clipboard

On Windows, ^X doesn't interrupt F mode if any other key is pressed first

Open gwsw opened this issue 2 years ago • 3 comments

Steps to reproduce:

  1. Build less with Microsoft Visual C on Windows.
  2. While viewing a file, press F.
  3. While "Waiting for data" message is displayed, press "k".
  4. Press ^X.

Expected behavior: should exit F mode. Actual behavior: remains in F mode. Works as expected if step 3 is omitted.

gwsw avatar Sep 24 '23 17:09 gwsw

The problem is that iread() calls win32_kbhit() and WIN32getch() to read the "k", and then calls WIN32ungetch(). After that, all subsequent iterations of this code re-read the "k" even if ^X is pressed. The ^X should somehow bypass the queue? Or maybe we don't really need to unget chars input while reading?

gwsw avatar Sep 24 '23 17:09 gwsw

Fixed in 04746adebaa882844a054b50be33fa44b8252664.

gwsw avatar Sep 24 '23 17:09 gwsw

Fix in 04746adebaa882844a054b50be33fa44b8252664 was bad; reverted it so this is still open.

gwsw avatar Sep 24 '23 19:09 gwsw