-
Notifications
You must be signed in to change notification settings - Fork 253
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
Add phantom space after characters usually followed by space #564
Conversation
I just tested this, it looks like it does the trick. I found a case where two spaces where added after a suggestion commit but I cannot figure out the exact conditions to reproduce this. Also, I investigated a bit more and I also ended up in thinking Again thanks for your great contributions :) |
Thanks for testing! Adding the setting should be ok, I'll ask for help if I have some trouble with this. |
I noticed another issue with this change: when trying to enter URLs, there is a space added. There already is some check that avoids this (RichInputConnection.textBeforeCursorLooksLikeURL), but it doesn't recognize e.g. github.com as URL. I also saw you linked #563 to this issue, but I don't think this will fix it. Anyway, I'm beginning to see more and more why you "really don't think the needed changes are that simple". |
So to summarize some auto-space issues that currently exist only when entering a word via a suggestion, and that will occur more frequently with this PR, but IMO should be fixed anyway:
I tested the solutions and they appear to work. Should I add them to this PR, or open another one? |
I added the experimental setting. Is the description ok? One small change I did is that I moved the inserting of space to the else-branch of the check above, because at this place the check for |
When tapping a suggestion, a phantom space is added, and this phantom space is kept if a "character usually followed by space" (e.g. punctuation) is entered, so that on starting the next word the space is inserted.
When writing a word without tapping a suggestion, no phantom space is added and thus the user needs to add the space after punctuation (and other characters) manually, which I and others (#252) find rather annoying and inconsistent (why is it added when tapping suggestion, but not when typing the word manually).
With this PR, a phantom space is added when entering a separator that is "usually followed by space", if the user "was composing a word". The latter restriction is necessary to avoid auto-inserting spaces when trying to enter decimal numbers.
A problem that remains is that when ending a sentence on a number, there will not be a phantom space. This is the same behavior as on Gboard, but still not good.
[Edit: I was wrong, Gboard does not insert a space when not using suggestions, same as current OpenBoard]
I tried inserting
in line 839 (when entering a non-separator, e.g. a letter) instead of the proposed change.
Then spaces are added even if sentence ends on a number, but the first word in the new sentence isn't capitalised. I think this would be much worse than the flaw of my proposed change...
[Edit: and then it becomes impossible to remove an unwanted inserted space without moving the cursor]
Fixes #252
Fixes #563