Repository: spyder-ide/spyder

Issue:
`Alt Gr + F` triggering Find in files plugin instead of square brackets (`[`) on QWERTZ (Hungarian) keyboard layout
### What steps will reproduce the problem?

<!--- You can use Markdown here --->

I am not able to write the first square brackets on QWERTZ (Hungarian) keyboard ('[', ALT GR+F) in Spyder editor and console, too.
This problem is existing from 5.x.x version and last version where it is working properly is 4.2.5.
Is it a bug?


Discussion:
Hi @ScentHounds thanks for the feedback, I'm not totally sure if this is a bug we can solve from our side but could you tell us more about your setup (OS, python version, qt/pyqt version, how Spyder was installed, etc)? Without more information there is not much we can do to help you, sorry :/
Hi @dalthviz,
thank you for your fast feedback and sorry for the insufficient information.
So, my OS is Windows 10, I installed Spyder with Anaconda. Anaconda version is 2.0.3, Python version is 3.8.5, IPython v is7.22.0, Spyder version is 5.0.2. As I mentioned above, this problem is existing from Spyder version 5.0.0 and if I make a downgrade for version Spyder 4.2.5, in the same Anaconda version, the problem doesn't exist, everything works properly.
I hope these information will be enough for you, if not, pls let me know.
kind regards
Tamás
@ScentHounds when you do the downgrade are there any other packages that change its version beside Spyder? Like for example Qt/PyQt or others?
@dalthviz In case of downgrade everything looks like the same as at Spyder 5.0.2
Both cases QT 5.9.7; PyQ 5.9.7; Python 3.8.5
@ScentHounds could you reset your Spyder preferences and try again? Also, could you try to create a new env installing our latest release, Spyder  5.0.3, and check again? If nothing of that helps I'm not sure what else to suggest :/
@dalthviz, unfortunately your suggestion was not successfull nothing to change. But I think it is a bug, because if I change to English language and keyboard (QWERTY)  it's working  properly, I am able to write the square brackets, and if I change back to Hugarian language and keyboard (QWERTZ), the problem is existing. The keyboard is the same both cases, I change the languages and keyboards in OS W10 (ALT+right SHIFT)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
Hi @ScentHounds after checking this (I downloaded locally the Hungarian language/keyboard layout for Windows 10 and tried the key combinations you described) I think I now know what the problem is. Basically when typing `Alt Gr + F` this combination is being handled as the shortcut to switch to the Find pane/plugin. 

We will be checking this in a future release 👍🏼 

Hi @dalthviz , thank you so much for your patience and contribution to solve the above mentioned problem in new release.
Since I hit the same problem on Spyder 5.1.1 with the proper Czech keyboard on Windows 10, I would like just to add that (at least on the Czech keyboard) there is a bunch of `AltGr` combinations, needed for the programming work. See the wiki illustration [here](https://cs.wikipedia.org/wiki/Soubor:Windows_Czech_keyboard_layout.svg) (The blue symbols are emitted together with `AltGr`). So I wonder, how do you plan to address it?

Considering the `find_in_files` shortcut, in 5.1.1 version it is defined as `Ctrl+Alt+F`, and after deleting it the `[` started to work.
Hi @risa2000 to be honest we are not totally sure yet, so any suggestion or idea is appreciated :)
@dalthviz
I can only speak for Windows part, as I believe in linux, the Czech keyboard struggles to somehow mimic the Windows behavior, but the things work there differently and usually not so well.

I am also not that familiar with how Spyder worked before (or if it ever worked before) on the Czech (or other localized) keyboards in Windows. but I guess the first thing you probably need to decide is, if you want to support the localized keyboards in Windows, or not :). 

Then if you do go for the support I can see two ways to address it:

1)  Either revise the shortcuts and avoid defining them for `AltGr` (or `Ctrl+Alt`) keys which overlap with the localized symbols. This will be appreciated by all two users who are using localized keyboards ;)

2) Detect the clashing shortcuts in program and allow users to easily identify them and remove them. This will lead to "non-canonical" shortcuts as the users of the localized keyboard will have to redefine the clashing shortcuts themselves (and most likely everyone differently), but at least, with some detection support in the GUI, it will be easier to hunt them down and deal with them.

Currently, I am not aware of any other clashing shortcut, but it does not mean there are not any (as I might have not used all the keys yet), or that some will not creep in in the future when you get creative ;).
Notes:

* It seems possible to detect the current keyboard layout but only on Windows (see [this Stackoverflow](https://stackoverflow.com/questions/42047253/how-to-detect-current-keyboard-language-in-python/42047820) question).
* With that knowledge, we could automatically remap our `Ctrl+Alt` shortcuts to something else on Hungarian and Czech keyboards (as @risa2000 suggested).
* There's also [this](https://stackoverflow.com/questions/42047253/how-to-detect-current-keyboard-language-in-python/42047820) for Linux, but using a non-standard utility.
Hey guys, we can more easily fix this problem by using a different shortcut for this action. Is it ok if we use `Alt+Shift+F` instead?

Just checking with you because we don't have Hungarian or Czech keyboards to test.
@ccordoba12 `Shift+Alt` combo seems to be inert on Czech keyboard, i.e. it does not produce any specific symbols as seen on the layout I referenced in my first post in this thread. I would expect it to be the case for other Windows localized keyboards as well (at least with Latin alphabet, as Microsoft seems to be quite uniform in this), but have no idea, how does it behave on Linux. If inert on Linux too, it might be a good idea to use `Shift+Alt` instead of `Ctrl+Alt` on all shortcuts, or add a configuration option, which a user of a localized keyboard could use to switch the "prefix" keys globally.

There is however an intended behavior (at least on Windows) for each `Shift` and `Alt` keys separately, and right now, for example in Spyder editor, pressing `Shift+Alt+F`, produces `F` in the opened text file (as simply `Shift+F` would), and if only `Alt+F` is pressed it will open `File` submenu from the top menu.

For what concerns the Czech layout, if you are interested in testing it, on Windows (but I would assume on Linux as well), you only need to install the particular layout (i.e. Czech keyboard, but make sure it is not "Czech programmers keyboard" or some other derivative) and then switch to it - you do not need to switch anything else (e.g. locale, OS language). But I guess it might be only interesting for study purposes, if the `Shift+Alt` works well :wink:.
> Hey guys, we can more easily fix this problem by using a different shortcut for this action. Is it ok if we use `Alt+Shift+F` instead?
> 
> Just checking with you because we don't have Hungarian or Czech keyboards to test.


My promt solution was the same or somthing like that. I've been using it this way ever since with Hungarian keyboard
Ok, great! I'll change it to `Alt+Shift+F` for 5.2.0. Thanks for your help @risa2000 and @ScentHounds!

Resolving patch:
diff --git a/spyder/config/main.py b/spyder/config/main.py
--- a/spyder/config/main.py
+++ b/spyder/config/main.py
@@ -534,7 +534,7 @@
               'explorer/copy absolute path': 'Ctrl+Alt+C',
               'explorer/copy relative path': 'Ctrl+Alt+Shift+C',
               # ---- In plugins/findinfiles/plugin ----
-              'find_in_files/find in files': 'Ctrl+Alt+F',
+              'find_in_files/find in files': 'Alt+Shift+F',
               }),
             ('appearance', APPEARANCE),
             ]
@@ -637,4 +637,4 @@
 #    or if you want to *rename* options, then you need to do a MAJOR update in
 #    version, e.g. from 3.0.0 to 4.0.0
 # 3. You don't need to touch this value if you're just adding a new option
-CONF_VERSION = '70.1.0'
+CONF_VERSION = '70.2.0'


Test patch: