Re: [dev] [libgrapheme] Some questions about libgrapheme

2022-09-02 Thread atrtarget
If efficiency is not a concern, then you can easily use something like this (just a quick prototype, didn't verify if it's correct or not): [...] Thanks for the free code :) I think that will be the way to go in my case, since most input will be ascii and moving the cursor will be quite

Re: [dev] [libgrapheme] Some questions about libgrapheme

2022-09-02 Thread atrtarget
Hi! This is a really good suggestion, but I think it may add a lot of overhead since it would need to go through the entire buffer, and since moving the cursor is not very frequent (not more than changing you position or opening a new buffer), I think it would be better to do it the "lazy" w

Re: [dev] [libgrapheme] Some questions about libgrapheme

2022-09-02 Thread atrtarget
Thank you a lot for spending some time answering! The problem with this heuristic is that the algorithm can become very inefficient, especially when you have long preceding segments. If n is the offset-length, the worst-case runtime could be O((n-1)!) for a segment that is in fact of length n-1,

[dev] [libgrapheme] Some questions about libgrapheme

2022-09-01 Thread atrtarget
libgrapheme looks really useful, but I still don't get some things from it. For example, if I need to get back one grapheme, how should I do it since there's no `grapheme_prev_character_break`? And to get the number of columns a character takes up, should I convert everything to wchar and use `