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

Esc in terminal window does not shift focus back to the document well. #13

Closed
clboles opened this issue Jul 28, 2017 · 5 comments
Closed

Comments

@clboles
Copy link

clboles commented Jul 28, 2017

In VS tool windows, the Esc key generally returns focus back to the previously active document. It would be nice if terminal window supported this as well since it's such a common muscle memory.

I wouldn't want to lose the behavior where Esc clears the input line in the terminal window, though. Perhaps Esc should be special cased to support both. If the user has typed input, then Esc should clear the line and keep focus in the terminal. If there is no input, then Esc could release focus from the tool window.

@ZoeyR
Copy link
Owner

ZoeyR commented Jul 28, 2017

I'm not sure if this is a feature I can support. For simple terminal applications it would be trivial to contextualize it. But consider the case where a user has an application such as vim open. The esc key has an important function in vim and since vim uses ncurses to write text at various locations in the terminal window there is no reliable way to contextualize it. Users can always use Ctrl+Tab to navigate away from the terminal without a mouse.

@clboles
Copy link
Author

clboles commented Jul 29, 2017

Are you able to tell when an executable is running vs when just idling in the shell waiting for input? I think it would be an acceptable tradeoff for Esc to only release focus when sitting idle and not in another console app.

The challenge you're going to continually encounter is terminal behavior conflicting with standard VS windowing/keyboard behavior. Finding the right balance is going to be key to this feeling right in the IDE. It's looking promising so far!

@ZoeyR
Copy link
Owner

ZoeyR commented Jul 29, 2017

Unfortunately I don't think there is a way for me to determine if there is a currently running process from the interface I have available to me. I use node-pty as a backend and it doesn't appear to offer me any hooks to determine if there is a running process.

@Tyriar
Copy link

Tyriar commented Aug 3, 2017

This should be closed as designed imo.

If the user has typed input, then Esc should clear the line and keep focus in the terminal. If there is no input, then Esc could release focus from the tool window.

node-pty just provides an input and an output stream, to us/xterm.js there is no differentiating input, prompt and output. This is something I've been thinking of for quite a while though so it may eventually be solved. I recommend not bothering looking into this but instead tracking microsoft/vscode#20676 for updates, it is not anywhere near as trivial as it seems 😃

Unfortunately I don't think there is a way for me to determine if there is a currently running process from the interface I have available to me.

This is true, even if there was I'd recommend against it as esc can be eaten by processes that are not the outer shell too. (eg. vim).

The challenge you're going to continually encounter is terminal behavior conflicting with standard VS windowing/keyboard behavior. Finding the right balance is going to be key to this feeling right in the IDE. It's looking promising so far!

VS Code gets around this by having a concept of "commands to skip the shell"; a list of commands that will not be sent to be handled by xterm.js. I'm not sure if this would translate well to VS.

@ZoeyR
Copy link
Owner

ZoeyR commented Aug 10, 2017

This issue was moved to microsoft/WhackWhackTerminal#15

@ZoeyR ZoeyR closed this as completed Aug 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants