Closed mitryp closed 1 year ago
Is there any particular reason why there are used two nested text spans in the ColoredTextEditingController._generateSpans
instead of one?
yield TextSpan(
children: [
TextSpan(
text: text.substring(
mistake.offset,
min(mistake.endOffset, text.length),
),
mouseCursor: MaterialStateMouseCursor.clickable,
style: style?.copyWith(
backgroundColor: mistakeColor.withOpacity(
highlightStyle.backgroundOpacity,
),
decoration: highlightStyle.decoration,
decorationColor: mistakeColor,
decorationThickness: highlightStyle.mistakeLineThickness,
),
recognizer: _onTap,
),
],
);
Resolves #39
Range guards prevent the
ColoredTextEditingController
from creating mistakes highlighting TextSpans with substrings of the text that are longer than the current text.