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, because of the single backsteps
it has to take.

Quite inefficient really, but I guess it's fine since my usage would be
only user input (left arrow)

The proper way to solve the column-problem is to render each grapheme
cluster and see how wide the font-rendering-library renders it, given
it depends on the font. I know that this isn't satisfactory, but that's
how it is.

In the case of a terminal would this mean asking for the position of the
cursor after every character I print? My usage would be to avoid terminal
induced soft-wraps in a text editor.

Anyway, thanks again for the help!

Reply via email to