@@ -10,6 +10,7 @@ function splitLines(string){ return string.split(/\r?\n|\r/); };
10
10
function StringStream ( string ) {
11
11
this . pos = this . start = 0 ;
12
12
this . string = string ;
13
+ this . lineStart = 0 ;
13
14
}
14
15
StringStream . prototype = {
15
16
eol : function ( ) { return this . pos >= this . string . length ; } ,
@@ -41,7 +42,7 @@ StringStream.prototype = {
41
42
if ( found > - 1 ) { this . pos = found ; return true ; }
42
43
} ,
43
44
backUp : function ( n ) { this . pos -= n ; } ,
44
- column : function ( ) { return this . start ; } ,
45
+ column : function ( ) { return this . start - this . lineStart ; } ,
45
46
indentation : function ( ) { return 0 ; } ,
46
47
match : function ( pattern , consume , caseInsensitive ) {
47
48
if ( typeof pattern == "string" ) {
@@ -58,7 +59,12 @@ StringStream.prototype = {
58
59
return match ;
59
60
}
60
61
} ,
61
- current : function ( ) { return this . string . slice ( this . start , this . pos ) ; }
62
+ current : function ( ) { return this . string . slice ( this . start , this . pos ) ; } ,
63
+ hideFirstChars : function ( n , inner ) {
64
+ this . lineStart += n ;
65
+ try { return inner ( ) ; }
66
+ finally { this . lineStart -= n ; }
67
+ }
62
68
} ;
63
69
CodeMirror . StringStream = StringStream ;
64
70
0 commit comments