Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework input system #24

Closed
bragefuglseth opened this issue Jun 10, 2024 · 5 comments
Closed

Rework input system #24

bragefuglseth opened this issue Jun 10, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@bragefuglseth
Copy link
Owner

bragefuglseth commented Jun 10, 2024

The current input system only listens to when text has been committed from the input method, and then pushes that directly to a string. For #22 and #8 to be implemented, we need to mark letters as partially typed more often:

  • When preediting is being used.
  • When the "alias" of a letter is being typed out. For example, the letter "œ" should be possible to enter by typing "oe". If "o" is typed, the letter should be marked as partially typed. Once it's fully typed, it's replaced with the proper letter in the "typed text" string. If something else is typed, the letter should be marked as incorrect, and the cursor should move to the next letter.
@idoric
Copy link

idoric commented Jun 12, 2024

I thought about this proposal in connection with #22. There is a case that I had not talked about in #22 because it was not covered by Monkeytype, but which has its place with this new proposal: French quotation mark.

French quotation marks are used as follows: « + NNBSP + the quote + NNBSP + ». Example: « Ceci est une citation ». By default, when typing in a word processor configured for French, the character " is automatically replaced by « + (N)NBSP¹ or (N)NBSP + » depending on the context. Analyzing the context would be a much more ambitious proposition than expected. Fortunately I think there is another solution.

Keypunch wouldn’t need to act like a word processor, because it has an enormous facility compared to that type of software: it knows in advance the text that is going to be typed. It seems simpler to me to split the text into tokens and for each accept one or more sequences of characters. For example « C’est un œuf ! » would be cut into |« |C|’|e|s|t| |u|n| |œ|u|f| !| »|, then |« | would be validated with « + NNBSP, « + NBSP or ", |C| would (only) be validated with C, |’| would be validated with ’ or ', |œ| with œ or o + e, | !| with NNBSP + !, NBSP + ! or !, etc.

(In the hypothesis of such a system it would be easy to add an option for those who would like to type the text exactly as it is written but who would not trust themselves not to yeld to temptation during training.)

I hope to move the thinking forward, and not confuse things more than necessary.

¹ By default LibreOffice uses NBSP for historical reasons but it’s configurable

@bragefuglseth
Copy link
Owner Author

bragefuglseth commented Jun 12, 2024

Thanks for the input! We use the guillemets in Norwegian typography too, so I'm familiar with them. I agree that it would be cool if those could just be entered as typewriter quotation marks.

In the system I'm fleshing out now, the app has a list of special letters with "aliases", which are additional accepted ways to type those letters. When an alias has been fully typed, it's converted to the corresponding letter. This system solves basically all the problems we have, especially if it can be made to play along with "preediting", commonly used by some input methods, too.

@idoric
Copy link

idoric commented Jun 12, 2024

I think I misunderstood your initial explanation, sorry. I would like to clarify one point, does the special list contain only single characters or also sequences of characters? if it’s the second answer, then it’s possible to indicate that the « + NNBSP sequence can be typed alternately with « + NBSP or ", and my previous comment would be obsolete.

especially if it can be made to play along with "preediting", commonly used by some input methods, too

I was worried that systems I don't even know could cause problems, so much the better if that's not the case.

@bragefuglseth
Copy link
Owner Author

bragefuglseth commented Jun 16, 2024

With the system I'm working on, we can at least have regular spaces as aliases for non-breaking ones, and typewriter quotation marks as aliases for guillemets. An alias can only apply to a single letter, not sequences of them. The aliases themselves can (obviously) consist of more than 1 letter, though.

@bragefuglseth
Copy link
Owner Author

Happy to report that the rework has landed. This required quite a lot of new plumbing and string manipulation, so please let me know if there are any issues to iron out.

@idoric:

Skjermopptak.fra.2024-06-20.16-22-56.webm

@developomp:

Skjermopptak.fra.2024-06-20.16-12-27.webm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants