Browse Source

Fixed bug that double escaped backslashes became three backslashes after parsing

pull/478/head
tbulle 11 years ago
parent
commit
6697216623
  1. 11
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/MarkupExtensionParser.cs

11
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/MarkupExtensionParser.cs

@ -96,12 +96,17 @@ namespace ICSharpCode.WpfDesign.XamlDom @@ -96,12 +96,17 @@ namespace ICSharpCode.WpfDesign.XamlDom
if (text[pos] == '"' || text[pos] == '\'') {
char quote = text[pos++];
CheckNotEOF();
int lastBackslashPos = -1;
while (!(text[pos] == quote && text[pos-1] != '\\')) {
char prev = text[pos-1];
int current = pos;
char c = text[pos++];
bool isEscapedBackslash = string.Concat(prev,c)=="\\\\";
if (c != '\\' || isEscapedBackslash)
//check if string is \\ and that the last backslash is not the previously saved char, ie that \\\\ does not become \\\ but just \\
bool isEscapedBackslash = string.Concat(text[current-1],c)=="\\\\" && current-1 != lastBackslashPos;
if (c != '\\' || isEscapedBackslash){
b.Append(c);
if(isEscapedBackslash)
lastBackslashPos = current;
}
CheckNotEOF();
}
pos++; // consume closing quote

Loading…
Cancel
Save