Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorMike Krüger <mikkrg@microsoft.com>2019-06-06 13:15:32 +0300
committerGitHub <noreply@github.com>2019-06-06 13:15:32 +0300
commit90188b9e4cc397df36ca9fa0626a9e970bfd88c3 (patch)
tree037b2af39ca9a05252bdc1e42b566c48295518ad /main/src
parent405ffee00487d7e1f53e04fada859b5f06cc858f (diff)
parent68e5f0a34d09b1d4c42de3ff279d9f7eedd39e92 (diff)
Merge pull request #7772 from mono/master-vsts904321
Fixes VSTS Bug 904321: [Feedback] Xamarin Android Breakpoint not work
Diffstat (limited to 'main/src')
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs35
-rw-r--r--main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/TextSegmentMarker.cs34
2 files changed, 46 insertions, 23 deletions
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs b/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs
index 6754d0b0ce..6fb760ace8 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs
@@ -1957,7 +1957,7 @@ namespace Mono.TextEditor
}
}
- var metrics = new LineMetrics {
+ var metrics = new LineMetrics {
LineSegment = line,
Layout = layout,
@@ -1980,18 +1980,26 @@ namespace Mono.TextEditor
if (!marker.IsVisible)
continue;
- if (marker.DrawBackground (textEditor, cr, metrics)) {
- isSelectionDrawn |= (marker.Flags & TextLineMarkerFlags.DrawsSelection) == TextLineMarkerFlags.DrawsSelection;
+ try {
+ if (marker.DrawBackground (textEditor, cr, metrics)) {
+ isSelectionDrawn |= (marker.Flags & TextLineMarkerFlags.DrawsSelection) == TextLineMarkerFlags.DrawsSelection;
+ }
+ } catch (Exception e) {
+ LoggingService.LogInternalError ("Error while drawing backround marker " + marker, e);
}
}
var textSegmentMarkers = TextDocument.OrderTextSegmentMarkersByInsertion (Document.GetVisibleTextSegmentMarkersAt (line)).ToList ();
foreach (var marker in textSegmentMarkers) {
- if (layout.Layout != null)
+ if (layout.Layout == null)
+ continue;
+ try {
marker.DrawBackground (textEditor, cr, metrics, offset, offset + length);
+ } catch (Exception e) {
+ LoggingService.LogInternalError ("Error while drawing backround marker " + marker, e);
+ }
}
-
if (DecorateLineBg != null)
DecorateLineBg (cr, layout, offset, length, xPos, y, selectionStartOffset, selectionEndOffset);
@@ -2175,17 +2183,24 @@ namespace Mono.TextEditor
}
}
}
- foreach (TextLineMarker marker in textEditor.Document.GetMarkers (line)) {
- if (!marker.IsVisible)
+ foreach (var marker in textEditor.Document.GetMarkers (line)) {
+ if (!marker.IsVisible || layout.Layout == null)
continue;
-
- if (layout.Layout != null)
+ try {
marker.Draw (textEditor, cr, metrics);
+ } catch (Exception e) {
+ LoggingService.LogInternalError ("Error while drawing line marker " + marker, e);
+ }
}
foreach (var marker in textSegmentMarkers) {
- if (layout.Layout != null)
+ if (layout.Layout == null)
+ continue;
+ try {
marker.Draw (textEditor, cr, metrics, offset, offset + length);
+ } catch (Exception e) {
+ LoggingService.LogInternalError ("Error while drawing segment marker " + marker, e);
+ }
}
position += System.Math.Floor (layout.LastLineWidth);
diff --git a/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/TextSegmentMarker.cs b/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/TextSegmentMarker.cs
index b53bc41e2f..2a688e976e 100644
--- a/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/TextSegmentMarker.cs
+++ b/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/TextSegmentMarker.cs
@@ -1,4 +1,4 @@
-//
+//
// TextSegmentMarker.cs
//
// Author:
@@ -152,18 +152,26 @@ namespace Mono.TextEditor
int /*lineNr,*/ x_pos;
uint curIndex = 0;
uint byteIndex = 0;
- uint idx = (uint)Math.Min (Math.Max (0, start - startOffset), metrics.Layout.Text.Length - 1);
- metrics.Layout.TranslateToUTF8Index (idx, ref curIndex, ref byteIndex);
-
- x_pos = layout.IndexToPos (System.Math.Max (0, (int)byteIndex)).X;
- @from = startXPos + (int)(x_pos / Pango.Scale.PangoScale);
-
- idx = (uint)Math.Min (Math.Max (0, end - startOffset), metrics.Layout.Text.Length - 1);
- metrics.Layout.TranslateToUTF8Index (idx, ref curIndex, ref byteIndex);
-
- x_pos = layout.IndexToPos (System.Math.Max (0, (int)byteIndex)).X;
-
- to = startXPos + (int)(x_pos / Pango.Scale.PangoScale);
+
+ var textLength = metrics.Layout.Text.Length;
+ if (textLength > 0) {
+ uint idx = (uint)Math.Min (Math.Max (0, start - startOffset), textLength - 1);
+ metrics.Layout.TranslateToUTF8Index (idx, ref curIndex, ref byteIndex);
+
+ x_pos = layout.IndexToPos (System.Math.Max (0, (int)byteIndex)).X;
+ @from = startXPos + (int)(x_pos / Pango.Scale.PangoScale);
+
+ idx = (uint)Math.Min (Math.Max (0, end - startOffset), textLength - 1);
+ metrics.Layout.TranslateToUTF8Index (idx, ref curIndex, ref byteIndex);
+
+ x_pos = layout.IndexToPos (System.Math.Max (0, (int)byteIndex)).X;
+
+ to = startXPos + (int)(x_pos / Pango.Scale.PangoScale);
+ } else {
+ @from = startXPos;
+ to = startXPos + editor.TextViewMargin.CharWidth;
+ }
+
var line = editor.GetLineByOffset (endOffset);
if (markerEnd > endOffset || @from == to) {
to += editor.TextViewMargin.CharWidth;