OneDeadKey / kalamine

Keyboard Layout Maker
MIT License
103 stars 29 forks source link

[keylayout] conflicting IDs when a character is included twice in the same layer #82

Closed robinmoussu closed 5 months ago

robinmoussu commented 7 months ago

I took ergol.toml, modified the name8 to "double-identifier", replaced the "-" on the alpha layer by an unbreakable space and "," by a narrow unbreakable space, and "S" by "A" (so that we have two A key, what are you going to do šŸ˜„)

In dist/double-identifier.toml, I get 2 sections with id "x00a0" (unbreakable space), 2 sections with id "202f" (narrow unbreakable space), and two section with id "a" which is incorrect.

I would suggest to use the layer + keycode as action id, like "alpha-0" for "a" in layer alpha, "shift-0" for "S", "altgr-18" for the symbol in altgr in the first key on the number row, "shift-space"ā€¦

double-identifier.toml.txt double-identifier.keylayout.txt

fabi1cazenave commented 7 months ago

Iā€™m afraid kalamine does not handle spaces outside of the spacebar, as mentioned in the User Guide.

I really donā€™t know how this should be supported. Using non-visible characters such as no-break spaces in the ASCII art description would be weird and very error-prone. Maybe an explicit definition with an escape char could make sense, e.g. \s for space, \t for tabā€¦ but IDK what one-char identifier could be used for nbsp and nnbsp.

fabi1cazenave commented 7 months ago

Closing as a duplicate of #31.

fabi1cazenave commented 7 months ago

Hmm, on second thoughtā€¦ re-opening, but only for the double-identifier bug that occurs whenever a character is included more than once on the base layer.

(FTR, as your title was focusing on space characters, I kinda missed the point. Renaming.)

robinmoussu commented 7 months ago

The is not a dup of #31, but thatā€™s my fault I did a typo in the explanation, and discovered that the bug was more important than I initially thought after creating the title.

It does affect all symbols that are present at least two times in layer alpha, shift and altgr, not just space-related characters. I did not checked all layers combination, but Iā€™m confident that they all causes issues. The only ā€œlayerā€ that doesnā€™t causes issue is having dupplicate symbols in the 1typo layer.

I edited the original message to fix the typo. I did remap the [S] key to A. So that both [A] and [S] are mapped to the A key

robinmoussu commented 7 months ago

Off-topic: And btw for (narrow) non-breaking space I did use the utf8 symbols in the source toml. It it parsed correctly, but indeed you need a visual clue in your text editor otherwise itā€™s confusing.

robinmoussu commented 7 months ago

@fabi1cazenave fabi1cazenave changed the title Fix support for mapping a symbol multiple times in alpha, shift and altgr layer [keylayout] conflicting IDs when a character is included twice in the same layer

Itā€™s not only in the same layer, but any duplicates between any of alpha, shift, altgr and altgr+shift (1typo is not affected)

fabi1cazenave commented 7 months ago

Well, for Lafayette and Ergo-L, all programming symbols are included twiceā€Æ: once in the alpha layer, once in the AltGr layer. But thereā€™s no conflict AFAIK.

So I think the current description is correct. It might be incomplete but I need to investigate a bit on this before I can refine it. Incomplete is better than incorrect, imho.

robinmoussu commented 7 months ago

I realize that to have issue, you need to have:

Currently itā€™s not possible to have 1typo symbol in altgr, so it is immune to this bug but it would if we add support to it.

I did a test where I modified the key at the right of [P] to have 1 in shift, and a symbol in 1typo. As you can see, two block with the same id are generated.

ergol-dupplicate.toml.txt ergol-dupplicate.keylayout.txt ergol-dupplicate.keylayout.expected.txt

fabi1cazenave commented 7 months ago

Currently itā€™s not possible to have 1typo symbol in altgr, so it is immune to this bug but it would if we add support to it.

Are you saying this bug is invalidā€Æ?

Iā€™m afraid I donā€™t understand your bug report. But if it involves an unsupported feature, well, thereā€™s nothing to report.

robinmoussu commented 7 months ago

Are you saying this bug is invalidā€Æ?

It cannot be exibited with altgr because 1dk+altgr is not valid currently


If you have the same symbol in one key that also have an 1dk for the same layer, and in another key that also have an associated 1dk layer, you get two "action" section with the same id.

What I did: map "shift + [P]" to 1, and map "1dk + shif + [P]" to any symbol (note: 1 is also available in 1, and that key as also a mapping on 1dk + alpha

What I got: two "action" section with the same id (the one for the alpha / 1dk+alpha of [1] and the one for shift / 1dk+shift of [P])

What I expected: two "action" section with different id.

nivopol commented 6 months ago

We have had exactly this case with Erglace 0.1 or 0.2 layoutsā€Æ: the Qwerty "-" key, outside of the 3x10 block, had a perfect copy in the layout in the 3x10. Please note that only one of both keys had a 1dk layer defined. It was enough to have the bug, because it was on the same layer. So we had a double "-" action generated. https://github.com/Lysquid/Erglace/blob/2711ac803b6894869db5f65f09ea7f9b8e703bfc/layouts/erglace.toml

Precisely, we had:

  1. both keys were generated as action, even if only one needed it and the other should have been a simple output,
  2. two action blocks were generated, so the file was straight out invalid.

Number 1 is an old bug, confirmed in Kalamine 0.25. Number 2 was introduced between Kalamine 0.25 and 0.29.

robinmoussu commented 6 months ago

Iā€™m working on it. I hope to have some time today, otherwise I will probably complete it next week.

fabi1cazenave commented 5 months ago

Stealing, as we really need to move on. Looks rather straight-forward, the hard part being to test without having a Mac. :-)

robinmoussu commented 5 months ago

Ping me when you are done, I should have time to test it