spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.22k stars 1.59k forks source link

Issue with Console typing #16186

Open mphemming opened 3 years ago

mphemming commented 3 years ago

Problem Description

Thank you for all your efforts developing Spyder, I have been using it for a few years now. There is one issue that I have found very frustrating. I will run some code in the Script window, then click onto the console to e.g. interactively plot something using matplotlib. However, when typing it switches back to the script window and I end up typing my commands in the script instead of in the console. This happens very frequently, perhaps 1-2 times every time I start writing into the console, and I wondered if it is related to the function help messages popping up on the screen?

What steps reproduce the problem?

  1. Run some code in the script window
  2. click on the console
  3. start typing into the console

What is the expected output? What do you see instead?

The focus shifts from the console to the script window and I actually type into my script rather than the console. I have to delete what I have typed into the script and click onto the console again to retype.

Paste Traceback/Error Below (if applicable)


There is no error

Versions

Dependencies


# Mandatory:
atomicwrites >=1.2.0          :  1.4.0 (OK)
chardet >=2.0.0               :  4.0.0 (OK)
cloudpickle >=0.5.0           :  1.6.0 (OK)
cookiecutter >=1.6.0          :  1.7.2 (OK)
diff_match_patch >=20181111   :  20200713 (OK)
intervaltree >=3.0.2          :  3.1.0 (OK)
IPython >=7.6.0               :  7.20.0 (OK)
jedi =0.17.2                  :  0.17.2 (OK)
jsonschema >=3.2.0            :  3.2.0 (OK)
keyring >=17.0.0              :  23.0.1 (OK)
nbconvert >=4.0               :  6.1.0 (OK)
numpydoc >=0.6.0              :  1.1.0 (OK)
paramiko >=2.4.0              :  2.7.2 (OK)
parso =0.7.0                  :  0.7.0 (OK)
pexpect >=4.4.0               :  4.8.0 (OK)
pickleshare >=0.4             :  0.7.5 (OK)
psutil >=5.3                  :  5.8.0 (OK)
pygments >=2.0                :  2.9.0 (OK)
pylint >=1.0                  :  2.9.3 (OK)
pyls >=0.36.2;<1.0.0          :  0.36.2 (OK)
pyls_black >=0.4.6            :  0.4.6 (OK)
pyls_spyder >=0.3.2;<0.4.0    :  0.3.2 (OK)
qdarkstyle =3.0.2             :  3.0.2 (OK)
qstylizer >=0.1.10            :  0.1.10 (OK)
qtawesome >=1.0.2             :  1.0.2 (OK)
qtconsole >=5.1.0             :  5.1.0 (OK)
qtpy >=1.5.0                  :  1.9.0 (OK)
rtree >=0.9.7                 :  0.9.7 (OK)
setuptools >=39.0.0           :  52.0.0.post20210125 (OK)
sphinx >=0.6.6                :  4.0.2 (OK)
spyder_kernels >=2.0.4;<2.1.0 :  2.0.5 (OK)
textdistance >=4.2.0          :  4.2.1 (OK)
three_merge >=0.1.1           :  0.1.1 (OK)
watchdog >=0.10.3             :  2.1.3 (OK)
zmq >=17                      :  20.0.0 (OK)

# Optional:
cython >=0.21                 :  0.29.24 (OK)
matplotlib >=2.0.0            :  3.3.4 (OK)
numpy >=1.7                   :  1.20.3 (OK)
pandas >=1.1.1                :  1.2.5 (OK)
scipy >=0.17.0                :  1.6.2 (OK)
sympy >=0.7.3                 :  1.8 (OK)
steff456 commented 3 years ago

Hi @mphemming,

If you click on the console, the focus will change to it and that's why you start typing on the console. You can use the shortcuts to focus the editor, so you can change automatically if you need to go back without using the mouse.

Hope this helps your workflow!

mphemming commented 3 years ago

Hi @steff456,

Thanks for your reply but this is not actually a solution to my issue. I am aware that I can click onto the console to start typing there. The issue is that after clicking onto the console and I start typing, it automatically switches back to the script window mid-typing. It seems to be a bug, and is very frustrating when using Spyder.

ccordoba12 commented 3 years ago

Hey @mphemming, could you upload an animated gif showing us how that happens? I really don't understand how this bug is generated, but a screenshot would help us to try to reproduce it.

You can generate animated gifs using the Licecap program.

mphemming commented 3 years ago

Hi @ccordoba12, I have sent you an email with an example video attached.

ccordoba12 commented 3 years ago

Hey @mphemming, thanks for the video. I understand what's happening now: if a code completion request is left pending in the editor while you move to the console and start typing there, we give focus back to the editor to show the result of that request.

The fix shouldn't be that hard, so we can probably include it in our 5.2.0 version, to be released at the end of September.

mphemming commented 3 years ago

@ccordoba12 great! thanks for looking into it. I look forward to version 5.2.0.