Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-investigate Ctrl+S pausing #809

Closed
miniksa opened this issue May 14, 2019 · 13 comments · Fixed by #15671
Closed

Re-investigate Ctrl+S pausing #809

miniksa opened this issue May 14, 2019 · 13 comments · Fixed by #15671
Labels
Area-Input Related to input processing (key presses, mouse, etc.) In-PR This issue has a related PR Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Tag-Fix Doesn't match tag requirements Priority-3 A description (P3) Product-Conhost For issues in the Console codebase
Milestone

Comments

@miniksa
Copy link
Member

miniksa commented May 14, 2019

At some point in history, we broke Ctrl+S to pause the output in the console host. I think it was around the time that we messed with the ExtendedEditKeys stuff.

I don't have the full context on this anymore, this is just another note-to-self title only bug I had as MSFT: 17790922 that I'm porting to the outside.

We need to reinvestigate the state of Ctrl+S pausing throughout the ages. How did v1 do it? How did v2 do it over the releases of Windows 10? Do we need to reintroduce it as an option somehow?

@miniksa miniksa added Product-Conhost For issues in the Console codebase Area-Input Related to input processing (key presses, mouse, etc.) Area-Interaction Interacting with the vintage console window (as opposed to driving via API or hooks) labels May 14, 2019
@oising
Copy link
Collaborator

oising commented May 15, 2019

Ctrl+S / XOFF , ctrl+Q XON. It's just ye olde software flow control. Speaking for myself, I'd use it quite a lot with streaming logs, cat, tail etc. A vestige from old teleprinters / terminals and carried on in VT.

@oising
Copy link
Collaborator

oising commented May 15, 2019

Oh, and yes, methinks you should definitely reintroduce it.

@eryksun
Copy link

eryksun commented May 15, 2019

In NT 4, with line-input mode enabled, console output could be suspended either via the pause key (VK_PAUSE) or Ctrl-S. I'm certain Ctrl-S was chosen for the convenience of people accustomed to terminals. That said, pressing any key resumes output; it doesn't have to be Ctrl-Q since the console isn't actually a terminal responding to XOFF/XON.

Around Windows 2000 the "ExtendedEditKey" registry setting was added. If this was enabled, custom edit keys could be defined in "ExtendedEditkeyCustom". I don't think this was ever documented. If no custom mapping was defined, it used a default mapping that included the Ctrl-S -> VK_PAUSE mapping. So Ctrl-S still worked by default even if "ExtendedEditKey" was enabled.

The new console exposes "ExtendedEditKey" in the properties dialog, but it's repurposed now for "extended text selection keys". Since "ExtendedEditkeyCustom" no longer seems to be implemented beyond a vestigial CONSOLE_REGISTRY_EXTENDEDEDITKEY_CUSTOM macro in the source, I think IsPauseKey should simply return true for VK_PAUSE or Ctrl-S, which will restore the original behavior.

On a related note, in the source I see that "ExtendedEditKey" and the properties dialog set the value of global g_fEditKeys, but it seems to be unused.

@ghost ghost added the Needs-Tag-Fix Doesn't match tag requirements label May 17, 2019
@miniksa miniksa added Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. and removed Mass-Chaos labels May 17, 2019
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label May 17, 2019
@floppytree
Copy link

Do I understand it correctly that it's not only the keybinding that is missing but the whole feature of suspending the output? I would greatly appreciate the reintroduction of Ctrl-S. Sorry, if this is a developer-only forum and I'm intruding.

@zadjii-msft zadjii-msft added this to the Console Backlog milestone Mar 8, 2021
@HBelusca
Copy link
Contributor

Please fix, as this is very useful to temporarily pause the console when e.g. an operation quickly iterates over a large number of items and displays corresponding feedback, and one wants to pause to see things appearing every now and then.

@KonstantinKhabarlak
Copy link

I think it would be nice to have full feature like in linux: suspend, move to background, move to foreground

@oising
Copy link
Collaborator

oising commented May 12, 2021

@KhabarlakKonstantin that is the responsibility of the shell (bash, cmd, pwsh, zsh), not the terminal (iterm2, xterm, windows terminal)

@smuuf
Copy link

smuuf commented Dec 20, 2021

Btw. I'm on Windows Terminal Preview, Version: 1.12.3472.0 (Windows 11, Insiders Dev, 22523.1000) and Ctrl+S (pause), Ctrl+Q (unpause) seems to work correctly, just as was said here #809 (comment).

Although I needed to use Google to find this exact comment to find out about this...

@zadjii-msft zadjii-msft modified the milestones: Console Backlog, Backlog Jan 4, 2022
@lhecker lhecker added Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-3 A description (P3) and removed Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Area-Interaction Interacting with the vintage console window (as opposed to driving via API or hooks) labels Jul 7, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added the In-PR This issue has a related PR label Jul 7, 2023
microsoft-github-policy-service bot pushed a commit that referenced this issue Jul 12, 2023
This reverts a number of changes to input handling to how it used to be
in conhost v1. It merges the input event coalescing logic into a single
function and inlines the console suspension event handling, because
soon these functions will receive `std::span` arguments which cannot
be preprocessed anymore, unlike a `std::deque`.

It also adds back support for Ctrl-S being an alias for VK_PAUSE
which was lost in commit fccc741 in 2018.

Closes #809

## Validation Steps Performed
* Unit and feature tests are ✅
* Ctrl-S pauses output 🎉
@Gemesys
Copy link

Gemesys commented Mar 8, 2024

This is great that this functionality - that was damaged at some point - has been restored. I am training networks - on Linux, I can Ctrl-s and check output -see how things are going. But on my new Windows-11 laptop, Ctrl-s still does NOTHING. I'm glad that this has been fixed - except I find I am unable to ENABLE the fix, despite having a current machine which is updating regularly. I am guessing a registry edit is needed?
SO, what is the secret trick to actual enable Ctrl-s / Ctrl-q flow-control style pause and resume, in Windows-11 Cmd (the legacy version, of course). Thanx for any info! - M.

@oising
Copy link
Collaborator

oising commented Mar 8, 2024

@Gemesys -- unfortunately this was closed by accident, as the comments in the triggering PR say ( #15671 (comment) ). I'll reopen it, unless @lhecker or @DHowett-MSFT disagree.

@oising oising reopened this Mar 8, 2024
@DHowett
Copy link
Member

DHowett commented Mar 8, 2024

Great catch @oising!

@lhecker
Copy link
Member

lhecker commented Mar 8, 2024

Since the PR was so long ago my memory of it is a bit hazy and I may be misreading the linked comment chain, but why do you believe this was not fixed? Ctrl+S for pausing works perfectly fine for me in OpenConsole and Windows Terminal 1.19 and later.

Edit: "perfectly fine" = "like old conhost". Dustin cleared me up about how XON/XOFF on other OS also properly pauses interactive prompts, etc., whereas the Windows implementation doesn't. Ctrl+S only pauses output for as long as you don't type any other characters. I wasn't aware about this difference and I apologize for that. We could consider changing this behavior. As far as I can tell it hasn't ever been different on Windows though even before ExtendedEditKeys was removed.

@oising
Copy link
Collaborator

oising commented Mar 13, 2024

Since the PR was so long ago my memory of it is a bit hazy and I may be misreading the linked comment chain, but why do you believe this was not fixed? Ctrl+S for pausing works perfectly fine for me in OpenConsole and Windows Terminal 1.19 and later.

Edit: "perfectly fine" = "like old conhost". Dustin cleared me up about how XON/XOFF on other OS also properly pauses interactive prompts, etc., whereas the Windows implementation doesn't. Ctrl+S only pauses output for as long as you don't type any other characters. I wasn't aware about this difference and I apologize for that. We could consider changing this behavior. As far as I can tell it hasn't ever been different on Windows though even before ExtendedEditKeys was removed.

Oh, well, this is news to me too :) I read the original PR as saying it wasn't implemented to spec/as expected. But it seems to function well enough for me with terminal now that I tested it.

@Gemesys Please ensure you're on the latest version of windows terminal.

@oising oising closed this as completed Mar 13, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Tag-Fix Doesn't match tag requirements label Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Input Related to input processing (key presses, mouse, etc.) In-PR This issue has a related PR Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Tag-Fix Doesn't match tag requirements Priority-3 A description (P3) Product-Conhost For issues in the Console codebase
Projects
None yet
Development

Successfully merging a pull request may close this issue.

12 participants