m4ns0ur / base64-vscode-plugin

Plugin to encode/decode base64 data
MIT License
2 stars 0 forks source link

Different default key bindings #4

Closed rloporp closed 1 year ago

rloporp commented 1 year ago

Maybe you should consider a different set of key bindings. With the current ones:

encode text to Base64:  Ctrl+Shift+6 (Ctrl+Cmd+6 in Mac)
decode Base64 to text:  Ctrl+Shift+7 (Ctrl+Cmd+7 in Mac) <--- Same as Toggle Line Comment
encode Hex to Base64:   Ctrl+Shift+8 (Ctrl+Cmd+8 in Mac)
decode Base64 to Hex:   Ctrl+Shift+9 (Ctrl+Cmd+9 in Mac)

The current key binding for decode Base64 to text is (outside Mac) identical to the widely used Toggle Line Comment, de facto disabling it.

It took me very long to figure it why my line comment shortcut wasn't working, and it turned out that this extension had "broken" it.

m4ns0ur commented 1 year ago

Thanks for reporting the issue! So what key binding(s) do you suggest as a Mac user?

rloporp commented 1 year ago

I'm both a Mac/Linux user. TBH I don't have a strong opinion about any specific keyboard shortcut, feel free to choose whatever you prefer. Thank you!!

m4ns0ur commented 1 year ago

Sure! Most probably I go with the same shortcuts in Linux and Mac (Ctrl+Shift+{6..9}).

rloporp commented 1 year ago

Ahhhh, now I got the misunderstanding: Ctrl + Shift + 7 (Ctrl + /) toggles line comments in several ISO keyboard layouts, including Danish, Italian, Portuguese, Spanish, Swedish, Turkish, etc.

You probably have an ANSI keyboard with the / somewhere else.

So, to sum up, in order to suffer the problem, two circumstances must concur:

rloporp commented 1 year ago

I spent some minutes learning from Wikipedia, and the / collision also happens on ANSI Spanish keyboards (several million users there).

m4ns0ur commented 1 year ago

Interesting! Yeah I set the shortcuts based on English layout (where ? and / sit near right Shift). I guess the safer option would be a combination with letters. Maybe Ctrl+Shift+E, Ctrl+Shift+D, Ctrl+Shift+H, Ctrl+Shift+X.

rloporp commented 1 year ago

I'm afraid VSCode core keyboard shortcuts are already "crowded":

Maybe you can leave the shortcuts empty and let the end users choose their own (?).

m4ns0ur commented 1 year ago

I assume having a set of default keybindings is a good idea, as it works out of the box for a variety of users (for sure, users can customize it afterward).

I spent some time to check what is the best practice and it seems having a keybindings using chords (for instance Ctrl+k in Linux and Windows - ⌘+k in Mac) is the best option.

What do you think?

encode text to Base64:  Ctrl+k Ctrl+4 (⌘+k ⌘+4 in Mac)
decode Base64 to text:  Ctrl+k Ctrl+5 (⌘+k ⌘+5 in Mac)
encode Hex to Base64:   Ctrl+k Ctrl+6 (⌘+k ⌘+6 in Mac)
decode Base64 to Hex:   Ctrl+k Ctrl+7 (⌘+k ⌘+7 in Mac)