@@ -69,9 +69,6 @@ class CodeController extends TextEditingController {
6969 /// A map of specific regexes to style
7070 final Map <String , TextStyle >? patternMap;
7171
72- /// A map of specific keywords to style
73- final Map <String , TextStyle >? stringMap;
74-
7572 /// Common editor params such as the size of a tab in spaces
7673 ///
7774 /// Will be exposed to all [modifiers]
@@ -101,7 +98,6 @@ class CodeController extends TextEditingController {
10198
10299 final _styleList = < TextStyle > [];
103100 final _modifierMap = < String , CodeModifier > {};
104- RegExp ? _styleRegExp;
105101 late PopupController popupController;
106102 final autocompleter = Autocompleter ();
107103 late final historyController = CodeHistoryController (codeController: this );
@@ -143,12 +139,9 @@ class CodeController extends TextEditingController {
143139 this .namedSectionParser,
144140 Set <String > readOnlySectionNames = const {},
145141 Set <String > visibleSectionNames = const {},
146- @Deprecated ('Use CodeTheme widget to provide theme to CodeField.' )
147- Map <String , TextStyle >? theme,
148142 this .analysisResult = const AnalysisResult (issues: []),
149143 this .patternMap,
150144 this .readOnly = false ,
151- this .stringMap,
152145 this .params = const EditorParams (),
153146 this .modifiers = const [
154147 IndentModifier (),
@@ -178,15 +171,10 @@ class CodeController extends TextEditingController {
178171
179172 // Build styleRegExp
180173 final patternList = < String > [];
181- if (stringMap != null ) {
182- patternList.addAll (stringMap! .keys.map ((e) => r'(\b' + e + r'\b)' ));
183- _styleList.addAll (stringMap! .values);
184- }
185174 if (patternMap != null ) {
186175 patternList.addAll (patternMap! .keys.map ((e) => '($e )' ));
187176 _styleList.addAll (patternMap! .values);
188177 }
189- _styleRegExp = RegExp (patternList.join ('|' ), multiLine: true );
190178
191179 popupController = PopupController (onCompletionSelected: insertSelectedWord);
192180
@@ -911,47 +899,9 @@ class CodeController extends TextEditingController {
911899 ).build ();
912900 }
913901
914- if (_styleRegExp != null ) {
915- return _processPatterns (text, style);
916- }
917-
918902 return TextSpan (text: text, style: style);
919903 }
920904
921- TextSpan _processPatterns (String text, TextStyle ? style) {
922- final children = < TextSpan > [];
923-
924- text.splitMapJoin (
925- _styleRegExp! ,
926- onMatch: (Match m) {
927- if (_styleList.isEmpty) {
928- return '' ;
929- }
930-
931- int idx;
932- for (idx = 1 ;
933- idx < m.groupCount &&
934- idx <= _styleList.length &&
935- m.group (idx) == null ;
936- idx++ ) {}
937-
938- children.add (
939- TextSpan (
940- text: m[0 ],
941- style: _styleList[idx - 1 ],
942- ),
943- );
944- return '' ;
945- },
946- onNonMatch: (String span) {
947- children.add (TextSpan (text: span, style: style));
948- return '' ;
949- },
950- );
951-
952- return TextSpan (style: style, children: children);
953- }
954-
955905 CodeThemeData _getTheme (BuildContext context) {
956906 return CodeTheme .of (context) ?? CodeThemeData ();
957907 }
0 commit comments