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

Track buffer on text nodes #155

Open
1ec5 opened this issue Dec 30, 2015 · 0 comments
Open

Track buffer on text nodes #155

1ec5 opened this issue Dec 30, 2015 · 0 comments

Comments

@1ec5
Copy link
Owner

1ec5 commented Dec 30, 2015

Unlike system IMEs and CHIM/Mudim, AVIM looks at the current state of the input field at every keystroke; it doesn’t maintain a buffer. I’ve long been in favor of this approach and against maintaining a buffer, because it allows you to correct diacritics without retyping the word, and it avoids the entire class of stale buffer bugs. (It’s quite easy to run into these bugs in Mudim.) However, to implement #60, #81, #74, or #154, AVIM would need a buffer to avoid situations where the user’s intent can’t be reconstructed from the text field’s present value.

The solution would be to store two pieces of information as expando properties on the DOM text node being edited: the word immediately preceding the insertion point (the “buffer”) and an offset into the node (either to the start of the word or to the insertion point). For #154, the text node would also track whether the word in the buffer was being ignored.

AVIM would continue to consider the current state of the text field at each keypress, but this context could be supplemented by the buffer. To guard against staleness, the buffer can be compared to the node’s current text value. If it matches, the buffer can be used to continue the cancelation, rearrange the word based on the new keypress, etc. Otherwise, it would be cleared.

Since expando properties aren’t shared with Web content, they’re completely safe from manipulation by webpages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant