|
|
|
|
@ -16,6 +16,7 @@ import 'package:fluffychat/pangea/events/event_wrappers/pangea_representation_ev
|
|
|
|
|
import 'package:fluffychat/pangea/events/models/pangea_token_model.dart';
|
|
|
|
|
import 'package:fluffychat/pangea/events/models/representation_content_model.dart';
|
|
|
|
|
import 'package:fluffychat/pangea/learning_settings/constants/language_constants.dart';
|
|
|
|
|
import 'package:fluffychat/widgets/matrix.dart';
|
|
|
|
|
|
|
|
|
|
// import 'package:language_tool/language_tool.dart';
|
|
|
|
|
|
|
|
|
|
@ -358,6 +359,21 @@ class IGCTextData {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int? get _openMatchIndex {
|
|
|
|
|
final RegExp pattern = RegExp(r'span_card_overlay_\d+');
|
|
|
|
|
final String? matchingKeys =
|
|
|
|
|
MatrixState.pAnyState.getMatchingOverlayKeys(pattern).firstOrNull;
|
|
|
|
|
if (matchingKeys == null) return null;
|
|
|
|
|
final int? index = int.tryParse(matchingKeys.split("_").last);
|
|
|
|
|
if (index == null ||
|
|
|
|
|
matches.length <= index ||
|
|
|
|
|
matches[index].status != PangeaMatchStatus.open) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return index;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//PTODO - handle multitoken spans
|
|
|
|
|
/// Returns a list of [TextSpan]s used to display the text in the input field
|
|
|
|
|
/// with the appropriate styling for each error match.
|
|
|
|
|
@ -410,7 +426,11 @@ class IGCTextData {
|
|
|
|
|
getSpanItem(
|
|
|
|
|
start: match.match.offset,
|
|
|
|
|
end: match.match.offset + match.match.length,
|
|
|
|
|
style: match.textStyle(defaultStyle),
|
|
|
|
|
style: match.textStyle(
|
|
|
|
|
matchIndex,
|
|
|
|
|
_openMatchIndex,
|
|
|
|
|
defaultStyle,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|