Julow / Unexpected-Keyboard

A lightweight virtual keyboard for developers.
GNU General Public License v3.0
1.25k stars 168 forks source link

Compass-point synonyms for edge keys in layouts #628

Closed Spike-from-NH closed 1 month ago

Spike-from-NH commented 1 month ago

Adds eight compass-point synonyms for key1 through key8

Spike-from-NH commented 1 month ago

I don't see it; the net result in that case seems to be: keysflags |= (F_LOC<<1) | (F_LOC<<1) —the same bit gets set twice?

[Edit: No, that's just for loc keys. Then: keysflags |= (0<<1) | (0<<1) ?]

I can try to write (by imitation) a function that takes parameters attr1 and attr2. (Or better, modify parse_key_attr() to take two and behave as before if attr2 is empty?) (Then need another function if we stumble over a sensible third synonym?)

Julow commented 1 month ago

—the same bit gets set twice?

Not if the flags are different for the two conflicting keys.

Or better, modify parse_key_attr() to take two and behave as before if attr2 is empty?

I prefer having smaller functions that combine well rather than a bigger function that takes more arguments. But if you have an implementation in mind, go ahead.

Spike-from-NH commented 1 month ago

Not if the flags are different for the two conflicting keys.

But two synonyms have the same flag! So I'm still not convinced there is a bug. If there is not, just listing synonyms is better than creating a brittle function based on there being exactly two synonyms.

By the way, I don't care which prevails if the user specifies both nw= and key1=, though ideally, your new pop-up diagnostic should warn that the user may be confused.

Julow commented 1 month ago

But two synonyms have the same flag! So I'm still not convinced there is a bug.

Here's an example of where this bug can show up: Start from the default layout:

    <key key0="d" key1="loc accent_grave" key2="loc £" key3="loc accent_aigu"/>

Add nw="¡" to this key. The added key will not show up.

If there is not, just listing synonyms is better than creating a brittle function based on there being exactly two synonyms.

The implementation I have in mind is not brittle.

ideally, your new pop-up diagnostic should warn that the user may be confused.

That would also be a good way to do it! This definitely requires a new function.

Spike-from-NH commented 1 month ago

Add nw="¡" to this key. The added key will not show up.

Well, because the definition now includes two contradictory specifications for the northwest swipe (one with a LOC bit and one without). Again, I don't care what results in this case but, yes, a pop-up should warn the user.

How shall we proceed? I finally put a modern browser on a big tablet (so I won't get "Something went wrong!") but I am slow at writing Java, have not studied your diagnostic routine, and have no way to test my code before submitting.

Julow commented 1 month ago

Then, an error is definitely the best solution! I can suggest an implementation later this week.

Spike-from-NH commented 1 month ago

I've made more edits to this file. I saw a warning I had unsaved changes and blew past it. I leave it to @Julow to issue the pop-up error if both synonyms are defined incompatibly.

Spike-from-NH commented 1 month ago

Thank you for correcting, completing, merging, and yet calling it awesome!