-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
keymap defaults aren't always lists #497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think that having these keymaps set by default is a mistake; but more relevant to your question, here is another question: what is the problem with the present situation, which seems to accept either a string or a list of strings? |
Consider the situation that I encountered. I wanted to remove some keys from the default keymap so that I could use them for myself in my own app. So my code originally looped through the keymaps and popped any keys I was using from the lists. But, if a keymap was a string, not a list of strings, then you obviously can't pop it. Another situation would be some sort of check that some key was in a particular map:
However, if rcParam['keymap.foo'] = ['right'], as it should be, then the above boolean would act as expected. |
@WeatherGod, if you are motivated, a PR for 1.4.x that forces validation, together with whatever documentation is needed to make it clear that a keymap will end up always as a list of strings, seems reasonable to me. If your opinion has changed, then this can be closed. |
@WeatherGod: Sorry to get to this so late, but I agree with @efiring: If it's feasible to validate all the entries and make things consistent, I think that would be nice. An easier as less likely to break things option might be to just change the defaults to be lists. |
This is addressed by #3564 |
If one does not set any keymap settings in an rcParams, then the default keymaps are used from rcsetup.defaultParams. The validation function "validate_stringlist" will always return a list, however, some of the default values are given as just a string, not a list of strings. These values never go through validate_stringlist, and therefore, never get turned into a list.
Do we want to force a validation run on the defaults upon loading mpl, or do we want to just simply fix those entries to be lists? Note that there may be issues with users who have come to expect some of these entries to be strings.
The text was updated successfully, but these errors were encountered: