Quirk with shell tab, when switching between other applications

This is related to bringing the PyCharm application back into focus, after using a different application (Firefox, in my scenario). If you last used the shell tab, before switching away from PyCharm, then when you switch back, the shell tab will still be active, even if you activated PyCharm by clicking somewhere else in the application, such as the editor. To me, that's the heart of the problem: if you re-activate PyCharm by clicking inside of the editor and then you start typing, you won't be typing inside of the editor - you'll be typing in the shell. You can even select text inside of the editor - but you'll still be typing in the shell.

Here are the steps to observe the issue: (video: https://youtu.be/1bID_OaFbJw)

1. Open PyCharm, and open a file in the editor (a new scratch file with some dummy text will do).
2. Activate the shell tab, and be sure that the command line has focus. Running an arbitrary command (i.e. `pwd`, `uname`, `ls`, etc.) will demonstrate this.
3. Switch to another application.
4. Now the critical part: when re-activating PyCharm, no matter where you click within the PyCharm application - the editor window, the project tab, etc. - the shell/command line will have focus, and will receive your keyboard input.
4. In the video, I've typed the shortcut for Paste, Ctrl-V, and that output is sent to the shell, even though I've clearly selected text in the editor.

Note that this problem is especially problematic when you're in a flow of work that involves perhaps copying/pasting code from source docs, StackOverflow, or wherever - it's easy to be lulled into a false sense of security, thinking that you can just click inside of PyCharm and type "Ctrl-V"; but if you've last used the shell before switching away from PyCharm, when you switch back you will be inadvertently sending the contents of your clipboard to your shell, and line breaks in whatever you copied (frequently the case!) will be interpreted as "Enter" - so now you've just executed each and every line of whatever was in your clipboard. Usually this just causes harmless errors, but still - makes me twitchy!

And that's it! I wouldn't call this a serious issue of course - definitely a minor UI annoyance / corner-case - but the possibility of some nasty ramifications is very real. That aside, I very much appreciate the overall quality and features of PyCharm, just thought I'd share this in case it's something that might easily be addressed. Thanks very much, and have a great day!

=== About ===
Build version: PyCharm 2019.1.3 Build #PY-191.7479.30 May 29, 2019
Java version: 11.0.2+9-b159.60amd64
Operating System: Linux (4.15.0-51-generic, amd64) [Ubuntu 16.04 + Unity desktop]
JVM version: OpenJDK 64-Bit Server VM JetBrains s.r.o

=== System ===
Number of CPU: 4
Used memory: 322Mb
Free memory: 1691Mb
Total memory: 2014Mb
Maximum available memory: 2014Mb

=== Displays ===
Displays:
Display 0: 1920x1080; scale: 1.00
Display 1: 1920x1080; scale: 1.00
Display 2: 2560x1440; scale: 1.00

=== Plugins ===
Custom plugins: [Mongo Plugin (0.12.0), PyVenv Manage (1.2), BashSupport (1.7.7), Karma (191.7141.32), NodeJS (191.7479.1)]
Disabled plugins:[IntelliJ Configuration Script (191.7479.30), Markdown Navigator (2.5.2)]

1 comment
Comment actions Permalink

I strongly suspect this is related to the following known issues:

https://youtrack.jetbrains.com/issue/IDEA-194124

https://youtrack.jetbrains.com/issue/IDEA-199755

Especially the latter one, only it deals with splits rather than terminal. Please try to reproduce it, and if successful, this is basically the same issue. You can vote and follow.

Also, read the discussions in those tickets, some have workarounds you can try.

0

Please sign in to leave a comment.