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

Clear terminal with keyboard shortcut rather than a command #11584

Closed
sdegutis opened this issue Oct 22, 2021 · 16 comments
Closed

Clear terminal with keyboard shortcut rather than a command #11584

sdegutis opened this issue Oct 22, 2021 · 16 comments
Labels
Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Issue-Question For questions or discussion Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.

Comments

@sdegutis
Copy link

Description of the new feature/enhancement

In Apple Terminal, I'm used to pressing Cmd-K to clear the terminal. This is quicker and easier than typing clear, and doesn't clutter my command history either. I'm aware of binding a keyboard shortcut to do this, but that doesn't have the advantage of keeping my command history uncluttered.

Proposed technical implementation details (optional)

@sdegutis sdegutis added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Oct 22, 2021
@ghost ghost added Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Oct 22, 2021
@zadjii-msft
Copy link
Member

You're free to bind the action to whatever you'd like.

Try maybe:

{ "keys": "ctrl+shift+k", "command": { "action": "clearBuffer", "clear": "all" } },

@zadjii-msft zadjii-msft added Issue-Question For questions or discussion Resolution-Answered Related to questions that have been answered labels Oct 22, 2021
@sdegutis
Copy link
Author

This action is not recognized:

Value is not accepted. Valid values: "adjustFontSize", "closeOtherTabs", "closePane", "closeTab", "closeTabsAfter", "closeWindow", "commandPalette", "copy", "duplicateTab", "find", "findMatch", "focusPane", "globalSummon", "identifyWindow", "identifyWindows", "moveFocus", "moveTab", "newTab", "newWindow", "nextTab", "openNewTabDropdown", "openSettings", "openTabColorPicker", "openWindowRenamer", "paste", "prevTab", "renameTab", "openTabRenamer", "quakeMode", "resetFontSize", "resizePane", "renameWindow", "scrollDown", "scrollDownPage", "scrollUp", "scrollUpPage", "scrollToBottom", "scrollToTop", "sendInput", "setColorScheme", "setTabColor", "splitPane", "switchToTab", "tabSearch", "toggleAlwaysOnTop", "toggleFocusMode", "toggleFullscreen", "togglePaneZoom", "toggleReadOnlyMode", "toggleShaderEffects", "wt", "unbound".(1)

@zadjii-msft
Copy link
Member

Where are you getting that error? The schema validator in your editor, or from the Terminal itself? I may have forgot to update the schema... Which version of the Terminal are you using?

@sdegutis
Copy link
Author

I assume this is in a more recent version? I have 1.10.2714.0 that came built into Windows 11, and just checked Windows Store and it's not offering me a chance to update. So I assume I have the latest public version available, and that it just doesn't have this merge yet?

@sdegutis
Copy link
Author

I get it in the JSON validator inside VS Code when I edit settings.

@sdegutis
Copy link
Author

  1. Saving the JSON file and opening a new tab (just in case) and typing ls and using Ctrl-Shift-K doesn't clear the buffer.
  2. Clicking Save in Settings just overrides my action with { "command": "unbound", "keys": "ctrl+shift+k" },

@sdegutis
Copy link
Author

This is what I see btw:

image

Also this, but I assume it's caused by it guessing an alternative command (one with colors or something) and validating other fields:

image

@sdegutis
Copy link
Author

Btw it might be a good idea to make this be a built-in shortcut considering how many MacOS-familiar devs are probably going to be looking for it as they migrate to Windows 11.

@DHowett
Copy link
Member

DHowett commented Oct 22, 2021

Ah! Okay, this makes sense. There's a number of things happening here.

  1. We added the clearBuffer action in the preview release, 1.12. If you want to run it instead of Terminal Stable, it is still pretty stable. It just gives you access to new features before they hit the general population.
  2. Since it's in preview, it's not part of the "stable schema" (which should point at the 1.11 schema)
  3. Further, even 1.11 has not yet hit full availability. We've rolled it out to the Insider program population to make sure that it doesn't introduce any terrible crash bugs.
  4. We should consider binding it by default, that's for sure. We don't have the luxury of having a non-ctrl-based shortcut key that doesn't conflict with the OS, so our opportunity for picking things is pretty minimal.

This was implemented in #10906 to close /duplicate #1882.

You can follow that bug (1882) to get a notification when this moves into Stable, or install Preview today and bind it, OR wait six or so weeks for preview 1.12 to move to stable.

@ghost

This comment has been minimized.

@DHowett DHowett removed the Resolution-Answered Related to questions that have been answered label Oct 22, 2021
@ghost ghost added Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Oct 22, 2021
@sdegutis
Copy link
Author

Why not Ctrl-Shift-K if it's not already in the defaults?

@sdegutis
Copy link
Author

Also is there a way to get this behavior now, by sending some sort of special ANSI escape code to the terminal or something, via a custom shortcut, which would do the same thing that the upcoming feature internally does? Like, it looks like the special code is #define PTY_SIGNAL_CLEAR_WINDOW (2u) so can that somehow be turned into a CLI command to be bound to a custom shortcut, and then when the update comes out I can just delete it?

@DHowett
Copy link
Member

DHowett commented Oct 25, 2021

A client application can clear the entire buffer by emitting \e[2J\e[H\e[3J (which is what clear -x does on most terminfo configurations suggest.)

There's nothing Terminal itself can send into the input stream that'll affect a clear. If there were, #10906 would not have been required!

Why not Ctrl-Shift-K if it's not already in the defaults?

Fair. We're still trying to avoid binding more keys by default. Still, it's something we can consider.

@sdegutis
Copy link
Author

Thanks. And that PR does not clutter command history like clear -x would, right?

@DHowett
Copy link
Member

DHowett commented Oct 25, 2021

Correct!

@jcrben
Copy link

jcrben commented Oct 7, 2023

Does ctrl+k do anything else in Windows that could cause a conflict? I'm considering using that myself. At the very least, perhaps a recommendation could be provided that wouldn't conflict with other Windows features? nevermind, ctrl+k is an emacs keybinding to delete to the EOL

+1 for a default keyboard shortcut - I'd like to be able to easily tell a teammate "punch <shortcut>". Granted, I could set that up in the team's automated installer with fragments, but it would be nice to have a global standard across the world😄

See also:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Issue-Question For questions or discussion Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.
Projects
None yet
Development

No branches or pull requests

4 participants