diff options
author | Jose Miguel Torres <jostor@microsoft.com> | 2019-03-08 14:06:29 +0300 |
---|---|---|
committer | monojenkins <jo.shields+jenkins@xamarin.com> | 2019-03-08 14:57:10 +0300 |
commit | 7aadc5d4e502eb8edc45eb460d8a78a87888f691 (patch) | |
tree | d526b2a0c92eb4ae06e8dedb0ec89023d4d77071 /main | |
parent | 4e40e402945e7c92d59781478add97838b524a1f (diff) |
[SourceEditor] Takes line length as column when cursor is set at the end of the caret.
- When the cursor is at the end of the line, the caret Column is higher than line length so that after adding a new breakpoint, this is set at the line after. With this commit, we prevent it.
- Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/792482
Diffstat (limited to 'main')
-rw-r--r-- | main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs index d2f924732c..c91f7683c1 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs @@ -1487,8 +1487,9 @@ namespace MonoDevelop.SourceEditor } else if (args.Button == 1) { if (!string.IsNullOrEmpty (Document.FileName)) { if (args.LineSegment != null) { - int column = TextEditor.Caret.Line == args.LineNumber ? TextEditor.Caret.Column : 1; - + int column = TextEditor.Caret.Line == args.LineNumber ? + Math.Min (TextEditor.Caret.Column, args.LineSegment.Length) : 1; + lock (breakpoints) breakpoints.Toggle (Document.FileName, args.LineNumber, column); } |