It's a very basic feature, the most lacking if you ask me. Why it's mysteriously missing from all those IMGUI text editors?
It seems to be in high enough demand,
BalazsJako#13
and I don't understand why Balazs said "too much hassle. It would complicate vertical scroll calculations too much."
I can imagine several ways to do it. For example, keep two parallel representations of the same text: wrapped lines and not. Keeping these in sync seems pretty trivial. Then for scroll calculations, the wrapped view lines could be counted just as easily as if there was no wrapping.
It won't even take much extra memory or time (usually), because texts we edit mostly aren't large (and we don't resize editing windows often).
Yet another option: keep an index for every line, corresponding with their offset from the start in the wrapped view. (Or, a number of lines that the line makes when wrapped). Etc.
BTW, thank you, @goossens !
It seems like you keep pretty neat and thorough work with this editor. I'm thinking to use it for my personal notes' app I'm making.
It's a very basic feature, the most lacking if you ask me. Why it's mysteriously missing from all those IMGUI text editors?
It seems to be in high enough demand,
BalazsJako#13
and I don't understand why Balazs said "too much hassle. It would complicate vertical scroll calculations too much."
I can imagine several ways to do it. For example, keep two parallel representations of the same text: wrapped lines and not. Keeping these in sync seems pretty trivial. Then for scroll calculations, the wrapped view lines could be counted just as easily as if there was no wrapping.
It won't even take much extra memory or time (usually), because texts we edit mostly aren't large (and we don't resize editing windows often).
Yet another option: keep an index for every line, corresponding with their offset from the start in the wrapped view. (Or, a number of lines that the line makes when wrapped). Etc.
BTW, thank you, @goossens !
It seems like you keep pretty neat and thorough work with this editor. I'm thinking to use it for my personal notes' app I'm making.