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

fix(web): correct edit-path ordering at source 🖲️ #12925

Open
wants to merge 2 commits into
base: change/web/context-tracker-backspaces-and-alignment
Choose a base branch
from

Conversation

jahorton
Copy link
Contributor

Rather than correcting the context-matching edit-path after it's generated, what if we just... got it right the first time?

Finally decided to really look into the cause and remedy this... and add a unit test while I was at it.

@keymanapp-test-bot skip

@jahorton jahorton requested a review from mcdurdin as a code owner January 17, 2025 03:27
@keymanapp-test-bot keymanapp-test-bot bot added this to the A18S19 milestone Jan 17, 2025
@jahorton jahorton changed the title fix(web): correct edit-path ordering at source fix(web): correct edit-path ordering at source 🖲️ Jan 17, 2025
@darcywong00 darcywong00 modified the milestones: A18S19, A18S20 Jan 18, 2025
Copy link
Member

@mcdurdin mcdurdin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the implications of this? What problems was it causing?

@jahorton
Copy link
Contributor Author

What are the implications of this? What problems was it causing?

Note the changes in context-tracker.ts.

In particular, the predictive-text "context-tracking" engine seeks to align contexts before and after changes based on preserving a central band that doesn't change, then a thin area that might be altered, and only then areas that have deletions and insertions.

The ordering of the edit path, as it was before, required extra logic to "correct" this ordering on the right-hand side, near the text insertion point. Suppose a degenerate keystroke were added that emitted the following string: a b c d. In such a case, the logic in context-tracker.ts would not have caught it - there are too many whitespaces in there. Also, suppose a future in which we offer multi-word predictions - the same would apply then.

The "correction" logic was unable to handle these cases, and I originally did extend it - and the results are more complex than what is seen here. Then I realized, after a bit of inspection... that I could fix the underlying problem at its source, and in a manner that operated more simply and concisely.


This was giving me a few issues during at least one stage of development for #12884.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

3 participants