@@ -49,20 +49,26 @@ var C9SearchHighlightRules = function() {
49
49
"start" : [
50
50
{
51
51
tokenNames : [ "c9searchresults.constant.numeric" , "c9searchresults.text" , "c9searchresults.text" , "c9searchresults.keyword" ] ,
52
- regex : " (^\\ s+[0-9]+)(:\\s)(.+)" ,
52
+ regex : / ( ^ \s + [ 0 - 9 ] + ) ( : ) ( \d * \s ? ) ( [ ^ \r \n ] + ) / ,
53
53
onMatch : function ( val , state , stack ) {
54
54
var values = this . splitRegex . exec ( val ) ;
55
55
var types = this . tokenNames ;
56
56
var tokens = [ {
57
57
type : types [ 0 ] ,
58
58
value : values [ 1 ]
59
- } , {
59
+ } , {
60
60
type : types [ 1 ] ,
61
61
value : values [ 2 ]
62
62
} ] ;
63
63
64
+ if ( values [ 3 ] ) {
65
+ if ( values [ 3 ] == " " )
66
+ tokens [ 1 ] = { type : types [ 1 ] , value : values [ 2 ] + " " } ;
67
+ else
68
+ tokens . push ( { type : types [ 1 ] , value : values [ 3 ] } ) ;
69
+ }
64
70
var regex = stack [ 1 ] ;
65
- var str = values [ 3 ] ;
71
+ var str = values [ 4 ] ;
66
72
67
73
var m ;
68
74
var last = 0 ;
@@ -85,11 +91,7 @@ var C9SearchHighlightRules = function() {
85
91
}
86
92
} ,
87
93
{
88
- token : [ "string" , "text" ] , // single line
89
- regex : "(\\S.*)(:$)"
90
- } ,
91
- {
92
- regex : "Searching for .*$" ,
94
+ regex : "^Searching for [^\\r\\n]*$" ,
93
95
onMatch : function ( val , state , stack ) {
94
96
var parts = val . split ( "\x01" ) ;
95
97
if ( parts . length < 3 )
@@ -168,11 +170,26 @@ var C9SearchHighlightRules = function() {
168
170
}
169
171
} ,
170
172
{
171
- regex : "\\d+" ,
172
- token : "constant.numeric"
173
+ regex : "^(?=Found \\d+ matches)" ,
174
+ token : "text" ,
175
+ next : "numbers"
176
+ } ,
177
+ {
178
+ token : "string" , // single line
179
+ regex : "^\\S:?[^:]+" ,
180
+ next : "numbers"
173
181
}
174
- ]
182
+ ] ,
183
+ numbers :[ {
184
+ regex : "\\d+" ,
185
+ token : "constant.numeric"
186
+ } , {
187
+ regex : "$" ,
188
+ token : "text" ,
189
+ next : "start"
190
+ } ]
175
191
} ;
192
+ this . normalizeRules ( ) ;
176
193
} ;
177
194
178
195
oop . inherits ( C9SearchHighlightRules , TextHighlightRules ) ;
0 commit comments