Daniel Krüger
04/01/2024, 1:15 PMSquirrel
04/02/2024, 12:22 PMDaniel Krüger
04/02/2024, 12:32 PMCtrl+?
for example is a different combination in different keyboard layouts. I wanted to keep the "?" constant, not the physical keys which have to be pressed. The latter would be possible without the wizard. And I didn't want to maintain different shortcut settings for different layouts. So this was the easiest solution I could come up with. 🤷♂️ It would be almost possible without, but a tiny detail in the keyboard event handling makes this necessary: On a US layout Shift+/
is "?" and is reported as event.key === '?'
, but as soon as I add another modifier, like Meta+Shift+/
I get event.key === '/'
I suspect others either just use the physical location to determine the shortcut or they maintain different shortcut mappings for different keyboard layouts.Squirrel
04/02/2024, 1:43 PMShift-'/'
does not equal the character mapped to Meta-Shift-'/'
is not a mistake and needs not be corrected. As soon as you add another modifier, you're in a different and unrelated group in the keyboard layout, and you can't assume that the Meta-Shift
group equals the Shift
group.
There's really no such thing as Control-'?'
. When I see such a key binding, it confuses me, and I think it was made by some American who has a question mark key on their keyboard, and I assume it's not accessible to me. The key binding is really Control-Shift-'/'
, regardless of whether Shift-'/'
happens to type a question mark.
Keyboard layouts vary in what modifiers need to be pressed. Imagine you have the key binding Shift-'1'
, and then someone comes with a Czech keyboard, which requires holding Shift
to type digits, and then the key binding becomes the nonsensical Shift-Shift-'+'
.
Here's an excerpt from a handbook I'm writing in text editor design:
Key bindings should be the actual keys on the keyboard, not the characters the keys type after applying a keyboard layout that may change due to locale and user preference. Control-z should be the same place on the keyboard regardless of whether the keyboard layout causes the z key to type the character z (English), y (German), w (French), Я (Russian) or ; (Dvorak).
Daniel Krüger
04/02/2024, 2:15 PMShift-'/'
nor do I have Shift-'1'
as a keybinding.
Another note: I'm not sure if/where you're speaking of '/'
as the key in any keyboard layout that generates a '/'
, or if you mean the key location, that generates a '/'
on a US layout. If you were only speaking of the former, then your remark about Control-Shift-'/'
has the same problem as you described in your Czech example: On a german keyboard '/'
is typed by pressing Shift-'7'
, so there is no Shift-'/'
as this would be Shift-Shift-'/'
.
The part about not being clear enough how Control-'?'
can be typed is indeed something I have to clarify in the app.Daniel Krüger
04/02/2024, 2:29 PMSquirrel
04/02/2024, 3:18 PMj
, k
, l
, ;
, a variation of which is present in your app.
> Your example with the Czech keyboard layout is one of the cases I avoid with this design
Even if you never bind the digit keys, you'll still have problems with Russian layouts among others that don't have the letters a
to z
. I used to have a keyboard layout where a question mark is typed with the Alt Gr
modifier, which the calibration wizard does not support at all.
> I'm not sure if/where you're speaking of '/'
as the key in any keyboard layout that generates a '/'
, or if you mean the key location, that generates a '/'
on a US layout.
I wasn't generalizing this particular example beyond the US layout, so the distinction doesn't matter. When generalizing, my suggestion is to bind keys to actual locations every time.Daniel Krüger
04/02/2024, 7:49 PMDeclan Naughton
04/26/2024, 8:55 PMDaniel Krüger
04/27/2024, 2:48 PMDaniel Krüger
04/27/2024, 2:52 PMDeclan Naughton
04/27/2024, 9:27 PMDeclan Naughton
04/27/2024, 9:59 PMDaniel Krüger
04/29/2024, 7:31 AMresheet
value as an input and uses the ReSheet API from there. So after importing the function in ReSheet you'd call it with resheet
to get your Block. (A little bit like the module system workarounds predating ESM) So it would look something like that:
`@your/block-on-npm`:
export default function(resheet) {
return {
MyBlock: resheet.core.block.create({
/* your block definition */
})
}
}
in ReSheet:
myLib
= (await import('<https://esm.sh/@your/block-on-npm?external=react').default(resheet>)
/myLib.MyBlock
You can also send me a private message any time, I'm happy to help if for example you're trying to build something and the documentation is lacking or some weird errors come up.Declan Naughton
04/29/2024, 12:11 PM