Changed keyboard shortcut for indent/outdent #3835
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
tl;dr: Indent/outdent shortcuts did not work on macOS. Switching from
Control + Shift + .
toTab
for indent, and fromControl + Shift + ,
toShift + Tab
for outdent. Tests did pass.As discussed in this Anki forum thread, and many other older forum threads, shortcuts are not working for all systems or keyboard layouts. As Anki is widely used among language learners from different countries, the app is prone to the problem of users having switched their keyboard layout by adjusting system settings (e.g., I am switching between German, English US and Unicode Hex on my MacBook by pressing the
fn
button). Yet, even with default settings, not all keyboard shortcuts that are displayed as tooltips in the Anki app work. See the thread linked above for a non-exhaustive list of more than ten shortcuts not working on the up-to-date Anki version on macOS for other than standard English keyboard layouts, as the shortcuts are asking for keyboard combinations not possible on those keyboards.Example: Indent is tool tipped as
Control + Shift + .
, which works using a standard English keyboard layout. Yet, the.
(period) key is a so called writing system key as per W3C, and as such, the result a key press yields is different based on the keyboard layout a users is using: For standard English layout users, the key will yield a period irrespective ofShift
being pressed. For German users, pressing the period system key will yield a period only ifShift
is not pressed simultaneously. When pressingShift
as well, it will yield a colon. As such, the tool-tipped shortcut cannot be typed using some layouts, amongst them the German keyboard layout. (See more examples for this on the W3C proposed recommendation document linked at the beginning of this paragraph.)While we are working out the best solution (uniform shortcuts for all keyboard layouts? customisable shortcuts? let users select a locale in the settings? …), I thought it would not hurt to already fix the shortcut for indent/outdent.
Using
Tab
andShift + Tab
seemed to be natural options to me, as they are used for the mechanic in apps widely known, like Word, Pages, or Obsidian. Those keys are considered so called functional keys by the W3C (cf here), and as such will work on nearly all layouts. Adjusting shortcuts for other buttons is as easy—I successfully tried this with superscript by replacingControl + Shift + =
with some other combination, e.g.,Control + O
–if we were to agree on which combinations the shortcuts should have. In my opinion, the thread seems to be the right place to do that. As for this quick fix,./ninja checks
did pass for me on macOS.This is my first contribution to Anki code and the first thread in the forums I am taking part in. I am happy for feedback and advice. It would be an honour to contribute to this app that I have been a user of for many years, and no doubt will be for many more to come.