-
Notifications
You must be signed in to change notification settings - Fork 14
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
design question: Should transform_buffer
be incremental?
#42
Comments
Woah. Nice work with the input engine! Just curious, what is preventing you from introducing this incremental buffer in your input engine? 🤔 |
I'm sorry for my misleading question. I could cache typed keys. However, look at Lines 182 to 196 in 6c82a29
A for loop is called from start to end of the buffer for every new typed key, like transform_buffer(&self.buffer, &mut self.output);
// while "chaof" is typing, equivalent to
transform_buffer(&"c", &mut self.output);
transform_buffer(&"ch", &mut self.output);
transform_buffer(&"cha", &mut self.output);
transform_buffer(&"chao", &mut self.output);
transform_buffer(&"chaof", &mut self.output); If we could cache every things outside that for loop, we reduce allocations for Word, and avoid looping from the start of each word/buffer. |
Ah I see what you mean. That's a great idea. We should definitely add something like that. |
Hi, I use vi-rs for my linux input engine with a IBUS framework.
But IBus passes a single char each time a key typed.
For every key typed, I should display the preview string (as in Vietnameses) to users.
So I couldn't cache each/a word (
Vec<char>
) and pass it totransform_buffer
.So
transform_buffer
is called for every key typed.So I wonder if we could create a new incremental
transform_buffer
.The text was updated successfully, but these errors were encountered: