diff --git a/ILSpy/Options/DisplaySettings.cs b/ILSpy/Options/DisplaySettings.cs index deaba047f..154056659 100644 --- a/ILSpy/Options/DisplaySettings.cs +++ b/ILSpy/Options/DisplaySettings.cs @@ -247,6 +247,19 @@ namespace ICSharpCode.ILSpy.Options } } + bool highlightCurrentLine = false; + + public bool HighlightCurrentLine { + get { return highlightCurrentLine; } + set { + if (highlightCurrentLine != value) + { + highlightCurrentLine = value; + OnPropertyChanged(); + } + } + } + bool hideEmptyMetadataTables = true; public bool HideEmptyMetadataTables { @@ -277,6 +290,7 @@ namespace ICSharpCode.ILSpy.Options this.IndentationTabSize = s.indentationTabSize; this.IndentationSize = s.indentationSize; this.HighlightMatchingBraces = s.highlightMatchingBraces; + this.HighlightCurrentLine = s.highlightCurrentLine; this.HideEmptyMetadataTables = s.HideEmptyMetadataTables; } } diff --git a/ILSpy/Options/DisplaySettingsPanel.xaml b/ILSpy/Options/DisplaySettingsPanel.xaml index 082a60a77..7fe66212b 100644 --- a/ILSpy/Options/DisplaySettingsPanel.xaml +++ b/ILSpy/Options/DisplaySettingsPanel.xaml @@ -83,6 +83,7 @@ + diff --git a/ILSpy/Options/DisplaySettingsPanel.xaml.cs b/ILSpy/Options/DisplaySettingsPanel.xaml.cs index 720fd6bd2..203f3dbda 100644 --- a/ILSpy/Options/DisplaySettingsPanel.xaml.cs +++ b/ILSpy/Options/DisplaySettingsPanel.xaml.cs @@ -121,6 +121,7 @@ namespace ICSharpCode.ILSpy.Options s.IndentationSize = (int?)e.Attribute("IndentationSize") ?? 4; s.IndentationTabSize = (int?)e.Attribute("IndentationTabSize") ?? 4; s.HighlightMatchingBraces = (bool?)e.Attribute("HighlightMatchingBraces") ?? true; + s.HighlightCurrentLine = (bool?)e.Attribute("HighlightCurrentLine") ?? false; s.HideEmptyMetadataTables = (bool?)e.Attribute("HideEmptyMetadataTables") ?? true; return s; @@ -146,6 +147,7 @@ namespace ICSharpCode.ILSpy.Options section.SetAttributeValue("IndentationSize", s.IndentationSize); section.SetAttributeValue("IndentationTabSize", s.IndentationTabSize); section.SetAttributeValue("HighlightMatchingBraces", s.HighlightMatchingBraces); + section.SetAttributeValue("HighlightCurrentLine", s.HighlightCurrentLine); section.SetAttributeValue("HideEmptyMetadataTables", s.HideEmptyMetadataTables); XElement existingElement = root.Element("DisplaySettings"); diff --git a/ILSpy/Properties/Resources.Designer.cs b/ILSpy/Properties/Resources.Designer.cs index c46b294d8..3dc019586 100644 --- a/ILSpy/Properties/Resources.Designer.cs +++ b/ILSpy/Properties/Resources.Designer.cs @@ -1550,6 +1550,15 @@ namespace ICSharpCode.ILSpy.Properties { } } + /// + /// Looks up a localized string similar to Hightlight current line. + /// + public static string HighlightCurrentLine { + get { + return ResourceManager.GetString("HighlightCurrentLine", resourceCulture); + } + } + /// /// Looks up a localized string similar to Highlight matching braces. /// diff --git a/ILSpy/Properties/Resources.resx b/ILSpy/Properties/Resources.resx index be0899451..c42d773c4 100644 --- a/ILSpy/Properties/Resources.resx +++ b/ILSpy/Properties/Resources.resx @@ -543,6 +543,9 @@ Are you sure you want to continue? Hide empty metadata tables from tree view + + Hightlight current line + Highlight matching braces diff --git a/ILSpy/TextView/DecompilerTextView.cs b/ILSpy/TextView/DecompilerTextView.cs index a54664cdb..3d7dcc08c 100644 --- a/ILSpy/TextView/DecompilerTextView.cs +++ b/ILSpy/TextView/DecompilerTextView.cs @@ -156,6 +156,7 @@ namespace ICSharpCode.ILSpy.TextView .RegisterCommands(Application.Current.MainWindow.CommandBindings); ShowLineMargin(); + SetHighlightCurrentLine(); // add marker service & margin textEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService); @@ -180,10 +181,14 @@ namespace ICSharpCode.ILSpy.TextView void CurrentDisplaySettings_PropertyChanged(object sender, PropertyChangedEventArgs e) { - if (e.PropertyName == "ShowLineNumbers") + if (e.PropertyName == nameof(DisplaySettings.ShowLineNumbers)) { ShowLineMargin(); } + else if (e.PropertyName == nameof(DisplaySettings.HighlightCurrentLine)) + { + SetHighlightCurrentLine(); + } } void ShowLineMargin() @@ -197,6 +202,11 @@ namespace ICSharpCode.ILSpy.TextView } } + void SetHighlightCurrentLine() + { + textEditor.Options.HighlightCurrentLine = DisplaySettingsPanel.CurrentDisplaySettings.HighlightCurrentLine; + } + #endregion #region Tooltip support