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

Terminal: provide an action to clear the terminal #6603

Closed
bpasero opened this issue May 21, 2016 · 9 comments
Closed

Terminal: provide an action to clear the terminal #6603

bpasero opened this issue May 21, 2016 · 9 comments
Assignees
Labels
feature-request Request for new features or functionality terminal Integrated terminal issues

Comments

@bpasero
Copy link
Member

bpasero commented May 21, 2016

Similar to the output panel would be nice to have an action top right to clear the terminal contents.

@bpasero bpasero added the feature-request Request for new features or functionality label May 21, 2016
@Tyriar Tyriar added the terminal Integrated terminal issues label May 21, 2016
@Tyriar
Copy link
Member

Tyriar commented Jun 30, 2016

This will probably involve sending a particular key sequence to the xterm object.

@chrmarti
Copy link
Contributor

The following clears the terminal with two (related) issues:

  • There will be no prompt after clearing (like: bash-3.2$ )

  • Clearing while running something like vim or top will leave the terminal unusable.

    const esc = String.fromCharCode(27);
    this.xterm.write(${esc}[H${esc}[2J);

I'd suggest to not implement this and rely on the shell's built-in clearing (like clear in bash).

@Tyriar
Copy link
Member

Tyriar commented Jul 11, 2016

How about calling into eraseInDisplay with Erase All arguments?

@chrmarti
Copy link
Contributor

chrmarti commented Jul 11, 2016

That's what esc[2J does. esc[H additionally positions the caret in the top left corner. The problem remains that we don't know in what context we clear the terminal and therefore don't know how to properly prompt for input or if we even should clear the terminal in the first place.

@Tyriar
Copy link
Member

Tyriar commented Jul 11, 2016

You're right, I still think this should be done but it will need to be done upstream xtermjs/xterm.js#173

@Tyriar Tyriar added the upstream Issue identified as 'upstream' component related (exists outside of VS Code) label Jul 11, 2016
@chrmarti
Copy link
Contributor

There is a CSI code to lookup the current cursor position. That and a few others could potentially be used to delete all lines except the current one.

@Tyriar
Copy link
Member

Tyriar commented Jul 11, 2016

Exposing this in upstream would make things a lot more convenient for consumers, all they will need to do it xterm.clear() then. It should also be much safer since eraseInDisplay should really not be exposed, also sending key codes will fail if the terminal is currently executing a process.

@Tyriar
Copy link
Member

Tyriar commented Sep 17, 2016

Added the API in upstream and implemented the command. The ⌘K keybinding on mac is still blocked by #12187

@Tyriar Tyriar removed the upstream Issue identified as 'upstream' component related (exists outside of VS Code) label Sep 17, 2016
@Tyriar Tyriar added this to the September 2016 milestone Sep 17, 2016
@Tyriar
Copy link
Member

Tyriar commented Sep 25, 2016

Moved the keybinding to #12585 as it's not going to land for Sept.

@Tyriar Tyriar closed this as completed Sep 25, 2016
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality terminal Integrated terminal issues
Projects
None yet
Development

No branches or pull requests

3 participants