diff options
-rw-r--r-- | main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.cs | 6 | ||||
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ViewCommandHandlers.cs | 9 |
2 files changed, 5 insertions, 10 deletions
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.cs index 09722e3b1a..0e5aa25a14 100644 --- a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.cs +++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.cs @@ -369,6 +369,9 @@ namespace MonoDevelop.TextEditor { UpdateLineNumberMarginOption (); + var foldMargin = PropertyService.Get<bool> ("ShowFoldMargin"); + Imports.OutliningManagerService.GetOutliningManager (TextView).Enabled = foldMargin; + var newPolicyContainer = (Owner as IPolicyProvider)?.Policies; if (newPolicyContainer != policyContainer) { if (policyContainer != null) @@ -440,9 +443,6 @@ namespace MonoDevelop.TextEditor if (editorConfigContext.CurrentConventions.UniversalConventions.TryGetAllowTrailingWhitespace (out var allowTrailingWhitespace)) EditorOptions.SetOptionValue (DefaultOptions.TrimTrailingWhiteSpaceOptionName, !allowTrailingWhitespace); - var foldMargin = PropertyService.Get<bool>("ShowFoldMargin"); - Imports.OutliningManagerService.GetOutliningManager (this.TextView as ITextView).Enabled = foldMargin; - var setVerticalRulers = false; int [] verticalRulers = null; diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ViewCommandHandlers.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ViewCommandHandlers.cs index fd1fd88339..35d13428c6 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ViewCommandHandlers.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ViewCommandHandlers.cs @@ -522,15 +522,11 @@ namespace MonoDevelop.Ide.Gui protected void UpdateEnableDisableFolding (CommandInfo info) { info.Text = IsFoldMarkerMarginEnabled ? GettextCatalog.GetString ("Disable _Folding") : GettextCatalog.GetString ("Enable _Folding"); - info.Enabled = GetContent<IFoldable> () != null; - + info.Enabled = GetContent<IFoldable> () != null || + GetContent<Microsoft.VisualStudio.Text.Editor.ITextView3> () != null; // As we need to support both the new and the legacy editor, we need to check if perhaps // we are running in the new one. The legacy editor already implements <see cref="ITextView"/> // so we can't simply look for that and we do not want to import anything related to Cocoa. - if (!info.Enabled) { - var textView = GetContent<Microsoft.VisualStudio.Text.Editor.ITextView3> (); - info.Enabled = textView != null; - } } [CommandUpdateHandler (EditCommands.ToggleAllFoldings)] @@ -550,7 +546,6 @@ namespace MonoDevelop.Ide.Gui [CommandHandler (EditCommands.FoldDefinitions)] protected void FoldDefinitions () { - Microsoft.VisualStudio.Text.Editor.ITextView textView; GetContent <IFoldable> ().FoldDefinitions (); } |