File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -168,6 +168,7 @@ impl Row {
168
168
}
169
169
}
170
170
171
+ let mut prev_is_separator = true ;
171
172
let mut index = 0 ;
172
173
while let Some ( c) = chars. get ( index) {
173
174
if let Some ( word) = word {
@@ -180,11 +181,21 @@ impl Row {
180
181
}
181
182
}
182
183
183
- if c. is_ascii_digit ( ) {
184
+ let previous_highlight = if index > 0 {
185
+ highlighting. get ( index - 1 ) . unwrap_or ( & highlighting:: Type :: None )
186
+ } else {
187
+ & highlighting:: Type :: None
188
+ } ;
189
+
190
+ if ( c. is_ascii_digit ( )
191
+ && ( prev_is_separator || previous_highlight == & highlighting:: Type :: Number ) )
192
+ || ( c == & '.' && previous_highlight == & highlighting:: Type :: Number )
193
+ {
184
194
highlighting. push ( highlighting:: Type :: Number ) ;
185
195
} else {
186
196
highlighting. push ( highlighting:: Type :: None ) ;
187
197
}
198
+ prev_is_separator = c. is_ascii_punctuation ( ) || c. is_ascii_whitespace ( ) ;
188
199
index += 1 ;
189
200
}
190
201
self . highlighting = highlighting;
You can’t perform that action at this time.
0 commit comments