Browse Source

Syntax highlighting: Allow keyword groups without keywords to fix SD2-1354: Saving an empty keyword list using the highlighting editor causes the highlighting file to become invalid

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.1@2539 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 18 years ago
parent
commit
797979974d
  1. 3
      src/Libraries/ICSharpCode.TextEditor/Project/Resources/Mode.xsd
  2. 6
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextEditorControlBase.cs

3
src/Libraries/ICSharpCode.TextEditor/Project/Resources/Mode.xsd

@ -188,8 +188,9 @@ @@ -188,8 +188,9 @@
<!-- A grouping of keywords that sholuld be colored the same way -->
<xsd:complexType name="KeyWords">
<xsd:sequence>
<!-- allow groups with 0 keywords: this simplifies the syntax highlighting editor -->
<!-- A KeyWord -->
<xsd:element name="Key" type="Key" minOccurs="1" maxOccurs="unbounded">
<xsd:element name="Key" type="Key" minOccurs="0" maxOccurs="unbounded">
</xsd:element>
</xsd:sequence>
<!-- The name of the KeyWord group -->

6
src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextEditorControlBase.cs

@ -624,7 +624,11 @@ namespace ICSharpCode.TextEditor @@ -624,7 +624,11 @@ namespace ICSharpCode.TextEditor
document.UndoStack.ClearAll();
document.BookmarkManager.Clear();
if (autoLoadHighlighting) {
document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategyForFile(fileName);
try {
document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategyForFile(fileName);
} catch (HighlightingDefinitionInvalidException ex) {
MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
if (autodetectEncoding) {

Loading…
Cancel
Save