Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

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

Closed
ZoeyR opened this issue Aug 10, 2017 · 6 comments
Closed

Comments

@ZoeyR
Copy link
Contributor

ZoeyR commented Aug 10, 2017

From @clboles on July 28, 2017 14:22

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.

Copied from original issue: ZoeyR/WhackWhackTerminal#13

@ZoeyR
Copy link
Contributor Author

ZoeyR commented Aug 10, 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.

@ZoeyR
Copy link
Contributor Author

ZoeyR commented Aug 10, 2017

From @clboles on July 29, 2017 0:59

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
Contributor Author

ZoeyR commented Aug 10, 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.

@ZoeyR
Copy link
Contributor Author

ZoeyR commented Aug 10, 2017

From @Tyriar on August 3, 2017 5:59

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.

@armaandh
Copy link

armaandh commented Aug 21, 2017

Users can always use Ctrl+Tab to navigate away from the terminal without a mouse.

Just a quick note...when i'm in the terminal, i'm unable to use Ctrl-Tab to navigate away. Only through the mouse clicking into the code window can I go back to work. From the code window, pressing Ctrl-Tab however brings up the switcher and lets me go back to terminal window without problems.

@ZoeyR
Copy link
Contributor Author

ZoeyR commented Sep 14, 2017

Closing as designed at the suggestion of @Tyriar.

@armaandh I just landed a fix that passes Ctrl+Tab through to VS

@ZoeyR ZoeyR closed this as completed Sep 14, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants