diff options
Diffstat (limited to 'main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor')
5 files changed, 61 insertions, 31 deletions
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/AbstractUsagesExtension.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/AbstractUsagesExtension.cs index 102de5bf0a..a88335d795 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/AbstractUsagesExtension.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/AbstractUsagesExtension.cs @@ -71,7 +71,8 @@ namespace MonoDevelop.SourceEditor void HandleTextEditorDataSelectionChanged (object sender, EventArgs e) { - RemoveMarkers (); + if (TextEditorData.IsSomethingSelected) + RemoveMarkers (); } void HandleTextEditorDataDocumentTextReplaced (object sender, DocumentChangeEventArgs e) diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ErrorText.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ErrorText.cs index dadd156bd5..1f09e62575 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ErrorText.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ErrorText.cs @@ -40,11 +40,11 @@ namespace MonoDevelop.SourceEditor { public class ErrorText { - public Task Task { get; set; } + public UserTask Task { get; set; } public bool IsError { get; set; } public string ErrorMessage { get; set; } - public ErrorText (Task task, bool isError, string errorMessage) + public ErrorText (UserTask task, bool isError, string errorMessage) { this.Task = task; this.IsError = isError; diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleTextMarker.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleTextMarker.cs index 7484634970..c80f55b283 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleTextMarker.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleTextMarker.cs @@ -61,7 +61,7 @@ namespace MonoDevelop.SourceEditor get { return errors; } } - Task task; + UserTask task; DocumentLine lineSegment; // int editorAllocHeight = -1; // int lastLineLength = -1; @@ -143,7 +143,7 @@ namespace MonoDevelop.SourceEditor string initialText; bool isError; - internal MessageBubbleTextMarker (MessageBubbleCache cache, Task task, DocumentLine lineSegment, bool isError, string errorMessage) + internal MessageBubbleTextMarker (MessageBubbleCache cache, UserTask task, DocumentLine lineSegment, bool isError, string errorMessage) { if (cache == null) throw new ArgumentNullException ("cache"); @@ -158,7 +158,7 @@ namespace MonoDevelop.SourceEditor } static System.Text.RegularExpressions.Regex mcsErrorFormat = new System.Text.RegularExpressions.Regex ("(.+)\\(CS\\d+\\)\\Z"); - public void AddError (Task task, bool isError, string errorMessage) + public void AddError (UserTask task, bool isError, string errorMessage) { var match = mcsErrorFormat.Match (errorMessage); if (match.Success) diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorOptions.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorOptions.cs index 1aff7ad2ae..349021bdef 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorOptions.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorOptions.cs @@ -33,11 +33,18 @@ using MonoDevelop.Ide.Fonts; namespace MonoDevelop.SourceEditor { - public enum ControlLeftRightMode { + [Obsolete ("Use WordNavigationStyle")] + public enum ControlLeftRightMode + { MonoDevelop, Emacs, SharpDevelop - + } + + public enum WordNavigationStyle + { + Unix, + Windows } public enum LineEndingConversion { @@ -180,8 +187,8 @@ namespace MonoDevelop.SourceEditor case "OnTheFlyFormatting": this.OnTheFlyFormatting = (bool)args.NewValue; break; - case "ControlLeftRightMode": - this.ControlLeftRightMode = (ControlLeftRightMode)args.NewValue; + case "WordNavigationStyle": + this.WordNavigationStyle = (WordNavigationStyle)args.NewValue; break; case "EnableAnimations": base.EnableAnimations = (bool)args.NewValue; @@ -223,8 +230,13 @@ namespace MonoDevelop.SourceEditor this.defaultCommentFolding = PropertyService.Get ("DefaultCommentFolding", true); this.useViModes = PropertyService.Get ("UseViModes", false); this.onTheFlyFormatting = PropertyService.Get ("OnTheFlyFormatting", true); - var defaultControlMode = (ControlLeftRightMode)Enum.Parse (typeof(ControlLeftRightMode), DesktopService.DefaultControlLeftRightBehavior); - this.ControlLeftRightMode = PropertyService.Get ("ControlLeftRightMode", defaultControlMode); + + WordNavigationStyle defaultWordNavigation = WordNavigationStyle.Unix; + if (Platform.IsWindows || PropertyService.Get ("ControlLeftRightMode", (string)null) == "SharpDevelop") { + defaultWordNavigation = WordNavigationStyle.Windows; + } + this.WordNavigationStyle = PropertyService.Get ("WordNavigationStyle", defaultWordNavigation); + base.EnableAnimations = PropertyService.Get ("EnableAnimations", true); this.EnableHighlightUsages = PropertyService.Get ("EnableHighlightUsages", false); base.DrawIndentationMarkers = PropertyService.Get ("DrawIndentationMarkers", false); @@ -448,18 +460,38 @@ namespace MonoDevelop.SourceEditor get { return defaultEolMarker; } } - ControlLeftRightMode controlLeftRightMode = Platform.IsWindows - ? ControlLeftRightMode.SharpDevelop - : ControlLeftRightMode.MonoDevelop; - + WordNavigationStyle wordNavigationStyle = Platform.IsWindows + ? WordNavigationStyle.Windows + : WordNavigationStyle.Unix; + + [Obsolete("Use WordNavigationStyle")] public ControlLeftRightMode ControlLeftRightMode { get { - return controlLeftRightMode; + return WordNavigationStyle == WordNavigationStyle.Unix + ? ControlLeftRightMode.MonoDevelop + : ControlLeftRightMode.SharpDevelop; } set { - if (controlLeftRightMode != value) { - controlLeftRightMode = value; - PropertyService.Set ("ControlLeftRightMode", value); + switch (value) { + case ControlLeftRightMode.Emacs: + case ControlLeftRightMode.MonoDevelop: + WordNavigationStyle = WordNavigationStyle.Unix; + return; + default: + WordNavigationStyle = WordNavigationStyle.Windows; + return; + } + } + } + + public WordNavigationStyle WordNavigationStyle { + get { + return wordNavigationStyle; + } + set { + if (wordNavigationStyle != value) { + wordNavigationStyle = value; + PropertyService.Set ("WordNavigationStyle", value); SetWordFindStrategy (); OnChanged (EventArgs.Empty); } @@ -481,19 +513,16 @@ namespace MonoDevelop.SourceEditor void SetWordFindStrategy () { if (useViModes) { - this.wordFindStrategy = new Mono.TextEditor.Vi.ViWordFindStrategy (); + wordFindStrategy = new Mono.TextEditor.Vi.ViWordFindStrategy (); return; } - switch (ControlLeftRightMode) { - case ControlLeftRightMode.MonoDevelop: - this.wordFindStrategy = new EmacsWordFindStrategy (true); - break; - case ControlLeftRightMode.Emacs: - this.wordFindStrategy = new EmacsWordFindStrategy (false); + switch (WordNavigationStyle) { + case WordNavigationStyle.Windows: + wordFindStrategy = new SharpDevelopWordFindStrategy (); break; - case ControlLeftRightMode.SharpDevelop: - this.wordFindStrategy = new SharpDevelopWordFindStrategy (); + default: + wordFindStrategy = new EmacsWordFindStrategy (); break; } } diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs index d301d929f5..97788a8b15 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs @@ -562,7 +562,7 @@ namespace MonoDevelop.SourceEditor void UpdateTasks (object sender, TaskEventArgs e) { - Task[] tasks = TaskService.Errors.GetFileTasks (ContentName); + UserTask[] tasks = TaskService.Errors.GetFileTasks (ContentName); if (tasks == null) return; DisposeErrorMarkers (); // disposes messageBubbleCache as well. @@ -573,7 +573,7 @@ namespace MonoDevelop.SourceEditor messageBubbleCache.Dispose (); messageBubbleCache = new MessageBubbleCache (widget.TextEditor); - foreach (Task task in tasks) { + foreach (UserTask task in tasks) { if (task.Severity == TaskSeverity.Error || task.Severity == TaskSeverity.Warning) { if (IdeApp.Preferences.ShowMessageBubbles == ShowMessageBubbles.ForErrors && task.Severity == TaskSeverity.Warning) continue; |