Browse Source

Fixed problem with highlighting strategy ("default" words had explicit background info set, which caused problems with the CustomLineManager)

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@969 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
2f6560630d
  1. 23
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/DefaultHighlightingStrategy.cs

23
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/DefaultHighlightingStrategy.cs

@ -48,10 +48,11 @@ namespace ICSharpCode.TextEditor.Document @@ -48,10 +48,11 @@ namespace ICSharpCode.TextEditor.Document
{
this.name = name;
digitColor = new HighlightBackground("WindowText", "Window", false, false);
digitColor = new HighlightColor(SystemColors.WindowText, false, false);
defaultTextColor = new HighlightColor(SystemColors.WindowText, false, false);
// set small 'default color environment'
environmentColors["DefaultBackground"]= new HighlightBackground("WindowText", "Window", false, false);
environmentColors["Default"] = new HighlightBackground("WindowText", "Window", false, false);
environmentColors["Selection"] = new HighlightColor("HighlightText", "Highlight", false, false);
environmentColors["VRuler"] = new HighlightColor("ControlLight", "Window", false, false);
environmentColors["InvalidLines"] = new HighlightColor(Color.Red, false, false);
@ -175,8 +176,18 @@ namespace ICSharpCode.TextEditor.Document @@ -175,8 +176,18 @@ namespace ICSharpCode.TextEditor.Document
// defaultColor = color;
// }
HighlightColor defaultTextColor;
public HighlightColor DefaultTextColor {
get {
return defaultTextColor;
}
}
internal void SetColorFor(string name, HighlightColor color)
{
if (name == "Default")
defaultTextColor = new HighlightColor(color.Color, color.Bold, color.Italic);
environmentColors[name] = color;
}
@ -364,7 +375,7 @@ namespace ICSharpCode.TextEditor.Document @@ -364,7 +375,7 @@ namespace ICSharpCode.TextEditor.Document
processNextLine = false;
}
//// Alex: remove old words
//// Alex: remove old words
if (currentLine.Words!=null) currentLine.Words.Clear();
currentLine.Words = words;
currentLine.HighlightSpanStack = (currentSpanStack != null && currentSpanStack.Count > 0) ? currentSpanStack : null;
@ -394,7 +405,7 @@ namespace ICSharpCode.TextEditor.Document @@ -394,7 +405,7 @@ namespace ICSharpCode.TextEditor.Document
}
processNextLine = MarkTokensInLine(document, lineNumber, ref spanChanged);
processedLines[currentLine] = true;
processedLines[currentLine] = true;
++lineNumber;
}
}
@ -662,7 +673,7 @@ namespace ICSharpCode.TextEditor.Document @@ -662,7 +673,7 @@ namespace ICSharpCode.TextEditor.Document
if (c == null) {
c = activeSpan.Color;
if (c.Color == Color.Transparent) {
c = GetColorFor("DefaultBackground");
c = this.DefaultTextColor;
}
hasDefaultColor = true;
}
@ -670,7 +681,7 @@ namespace ICSharpCode.TextEditor.Document @@ -670,7 +681,7 @@ namespace ICSharpCode.TextEditor.Document
} else {
HighlightColor c = markNext != null ? markNext : GetColor(activeRuleSet, document, currentLine, currentOffset, currentLength);
if (c == null) {
words.Add(new TextWord(document, currentLine, currentOffset, currentLength, GetColorFor("DefaultBackground"), true));
words.Add(new TextWord(document, currentLine, currentOffset, currentLength, this.DefaultTextColor, true));
} else {
words.Add(new TextWord(document, currentLine, currentOffset, currentLength, c, false));
}

Loading…
Cancel
Save