I am rendering a giant document in a Paragraph widget. I have a search functionality. I'd like to be able to auto-scroll to the most relevant paragraph's title.
Solution
To do so, I need to be able to query the widget for the line number of some string. Since the line numbers change depending on the current size, I cannot determine this independently. This line number should be responsive to size changes.
Alternatives
I tried to predetermine the line number using String.lines(), however, when wrap occurs, this is no longer accurate.
I also searched the crate for the functionality but couldn't find it.
Problem
I am rendering a giant document in a
Paragraph
widget. I have a search functionality. I'd like to be able to auto-scroll to the most relevant paragraph's title.Solution
To do so, I need to be able to query the widget for the line number of some string. Since the line numbers change depending on the current size, I cannot determine this independently. This line number should be responsive to size changes.
Alternatives
I tried to predetermine the line number using
String.lines()
, however, when wrap occurs, this is no longer accurate. I also searched the crate for the functionality but couldn't find it.