Closed danielstuart14 closed 3 months ago
Is a PR with support just for the Qt backend (the others falling back to word-wrap
) something desired?
Of course the other backends would need to be extended later to also support it.
CSS has overflow-wrap: anywhere;
and overflow-wrap: break-word;
(ref)
The difference between the two is the way the minimum with is computed. But note that we currently already return 0 minimum-width with word-wrap (which is maybe not optimal)
I think it's make sense to have wrap: break-word
Is a PR with support just for the Qt backend (the others falling back to word-wrap) something desired?
Yes, that would be a good start. Implementing that in other backends can be done later and shouldn't be too difficult.
Currently, Slint only supports
word-wrap
andno-wrap
options for text wrapping. Whileword-wrap
works for wrapping human text, when dealing with a console output (which could return large hexadecimal values, strings, etc) this kind of wrapping isn't ideal.As so, a
char-wrap
mode would suit better for theses cases, always wrapping on the last character that fits the content.Here is an example (from SlintPad, using TextEdit with
word-wrap
):And here is how it would look like with
char-wrap
:It does look like implementing this for the Qt backend should be easier, as Qt itself supports
Qt_TextFlag_TextWrapAnywhere
and slint already usesQt_TextFlag_TextWordWrap
. I'm still figuring out how text wrapping works with femtovg, as well as with skia (which doesn't seem to support wrapping right now).