Please support word wrap
sma opened this issue · 2 comments
Please support your CodeField.wrap
property which currently seems to do nothing. This is the only feature I really need from an editor so it is rather unfortunate that after I struggles through all other issues I reported before, this should be the reason why I can't use it after all. It would also important for me that the wrap keeps the indentation. I think, the normal Flutter TextField
does not.
The challenge with word wrapping is probably keeping the gutter in sync which then needs to have different heights per line and the naive approach to layout each line twice might be too slow, I don't know. As you use a TextField
as a core, you probably cannot access the internal layout of its text rendering.
I noticed this issue (BertrandBev/code_field#6), which has been open since 2021, which means that text wrapping support has been missing for two years now, and because someone wants to restructure something somewhere in the Flutter framework (flutter/flutter#119430), I don't think we'll get a way to access line metrics and get a solution in the next few months.
A potential workaround for the Flutter issue is to:
- Iterate lines.
- For each line find its
y
the same way we calculate the suggestion box offset. - Draw line numbers at those
y
s.
It feels slow but should work for someone who really needs this.
This is not a top priority to us but if you make a PR we would be happy to review it.