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

Right-Alt shortcut overwrites default behavior in Spyder #12529

Open pjgorski opened 4 years ago

pjgorski commented 4 years ago

Issue Report Checklist

Problem Description

While still having Spyder 3.3.4 in the editor of Spyder I accidently pressed something. After that by pressing right-Alt + s instead of obtaining the letter 'ś', all open files save. Pressing just right-Alt makes all first letters in the Menu bar highligted.

There is no such shortcut listed in preferences. Normal file save (ctrl + s) works ok. And in the console right-Alt + s gives normal 'ś'.

I upgraded Spyder, and it still remains.

Earllier, I described the problem here: https://stackoverflow.com/questions/61220188/right-alt-shortcut-overwrites-default-behavior-in-spyder

What steps reproduce the problem?

NA

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

Clicking right-Alt+s should give 'ś' letter. It saves all open files instead and no letter is given. This happens only in the editor. In the console I can normally write 'ś'.

Paste Traceback/Error Below (if applicable)

NA

Versions

Dependencies


# Mandatory:
atomicwrites >=1.2.0           :  1.3.0 (OK)
chardet >=2.0.0                :  3.0.4 (OK)
cloudpickle >=0.5.0            :  1.3.0 (OK)
diff_match_patch >=20181111    :  20181111 (OK)
intervaltree                   :  None (OK)
IPython >=4.0                  :  7.13.0 (OK)
jedi =0.15.2                   :  0.15.2 (OK)
nbconvert >=4.0                :  5.6.1 (OK)
numpydoc >=0.6.0               :  0.9.2 (OK)
paramiko >=2.4.0               :  2.7.1 (OK)
parso =0.5.2                   :  0.5.2 (OK)
pexpect >=4.4.0                :  4.8.0 (OK)
pickleshare >=0.4              :  0.7.5 (OK)
psutil >=5.3                   :  5.7.0 (OK)
pygments >=2.0                 :  2.6.1 (OK)
pylint >=0.25                  :  2.4.4 (OK)
pyls >=0.31.9;<0.32.0          :  0.31.9 (OK)
qdarkstyle >=2.8               :  2.8 (OK)
qtawesome >=0.5.7              :  0.7.0 (OK)
qtconsole >=4.6.0              :  4.7.2 (OK)
qtpy >=1.5.0                   :  1.9.0 (OK)
rtree >=0.8.3                  :  0.9.3 (OK)
sphinx >=0.6.6                 :  2.4.4 (OK)
spyder_kernels >=1.9.0;<1.10.0 :  1.9.0 (OK)
watchdog                       :  None (OK)
zmq >=17                       :  18.1.1 (OK)

# Optional:
cython >=0.21                  :  0.29.15 (OK)
matplotlib >=2.0.0             :  3.1.3 (OK)
numpy >=1.7                    :  1.18.1 (OK)
pandas >=0.13.1                :  1.0.3 (OK)
scipy >=0.17.0                 :  1.4.1 (OK)
sympy >=0.7.3                  :  1.5.1 (OK)
ccordoba12 commented 4 years ago

@jnsebgosselin, any ideas about what could be happening here?

jnsebgosselin commented 4 years ago

I'll look into it.

jnsebgosselin commented 4 years ago

Ok, I'm not sure this is a bug after all and I'm not sure there is anything that we can do about it.

You can read a potential explanation for this behaviour at https://en.wikipedia.org/wiki/AltGr_key under the section Control + Alt as a substitute.

More specifically, it is said :

To allow the specific functionality of AltGr when typing non-English text on such keyboards, Windows allows it to be emulated by pressing the Alt key together with the Control key:

Ctrl+Alt ≈ AltGr

Therefore, it is recommended that this combination not be used as a modifier in Windows keyboard shortcuts as, depending on the keyboard layout and configuration, someone trying to type a special character with it may accidentally trigger the shortcut,[5] or the keypresses for the shortcut may be inadvertently interpreted as the user trying to input a special character.

So this is exactly what happens in my case. When I press AltGr + S the save all shortcut is triggered since it is mapped to Ctrl+Alt+ S. The same thing also occurs for AltGr + D since I have the docstrings shortcut mapped to the Ctrl+Alt+D.

The reason it is working in the console is because there is no shortcut mapped to Ctrl+Alt+ S.

image

jnsebgosselin commented 4 years ago

If I 'un-map' the save all shortcut, then Ctrl+Alt+S or AltGr+S the the ß is typed in the editor as expected.

Similarly, if I 'un-map' the docstrings shortcut, then I can write ð by pressing either Ctrl+Alt+D or AltGr+D

Important note : It seems like a restart of Spyder is required for this to work after clearing the shortcuts though. I think this is a bug. I'll open another issue about it.

pjgorski commented 4 years ago

Thanks, I did it and it works. Sorry for trouble. I thought it was a bug, because for sure I could type 'ś' using AltGr and then suddenly after I misclicked on sth I couldn't.

mateusz91t commented 3 years ago

Change the shortcut editor: save all (Ctrl + Alt + s) to other or clear it works properly. Thanks! image