This repository was archived by the owner on Sep 11, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +41
-5
lines changed
UI/Components/EditorElement/Foldings Expand file tree Collapse file tree 1 file changed +41
-5
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ public IEnumerable<NewFolding> CreateNewFoldings(ITextSource document)
8383 }
8484 break ;
8585 }
86- case '\ " ' :
86+ case '"' :
8787 {
8888 CommentMode = 3 ;
8989 break ;
@@ -117,17 +117,53 @@ public IEnumerable<NewFolding> CreateNewFoldings(ITextSource document)
117117 }
118118 case 3 :
119119 {
120- if ( c == '\" ' && document . GetCharAt ( i - 1 ) != '\\ ' )
120+ // if quote found, search backwards for backslashes
121+ if ( c == '"' )
121122 {
122- CommentMode = 0 ;
123+ var slashes = 0 ;
124+ for ( int j = i - 1 ; j >= 0 ; j -- )
125+ {
126+ if ( document . GetCharAt ( j ) == '\\ ' )
127+ {
128+ slashes ++ ;
129+ }
130+ else
131+ {
132+ break ;
133+ }
134+ }
135+ // if the total amount of subsequent backslashes found is even
136+ // it means the quote is not escaped
137+ if ( slashes % 2 == 0 )
138+ {
139+ CommentMode = 0 ;
140+ }
123141 }
124142 break ;
125143 }
126144 case 4 :
127145 {
128- if ( c == '\' ' && document . GetCharAt ( i - 1 ) != '\\ ' )
146+ // if apostrophe found, search backwards for backslashes
147+ if ( c == '\' ' )
129148 {
130- CommentMode = 0 ;
149+ var slashes = 0 ;
150+ for ( int j = i - 1 ; j >= 0 ; j -- )
151+ {
152+ if ( document . GetCharAt ( j ) == '\\ ' )
153+ {
154+ slashes ++ ;
155+ }
156+ else
157+ {
158+ break ;
159+ }
160+ }
161+ // if the total amount of subsequent backslashes found is even
162+ // it means the apostrophe is not escaped
163+ if ( slashes % 2 == 0 )
164+ {
165+ CommentMode = 0 ;
166+ }
131167 }
132168 break ;
133169 }
You can’t perform that action at this time.
0 commit comments