If I call textBox.GetLineFromCharIndex(int)
in a TextBox
with WordWrap = true
, it returns the line index as the user sees it (wrapped lines count as multiple lines), not the line according to the line breaks.
Line one extends to // <- word wrapped here. // <- logical line 1, GetLineFromCharIndex returns line 2 This is line two. // <- logical line 2, GetLineFromCharIndex returns line 3
Does anyone know of a solution to find the logical line from a character index rather than the displayed line?