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 <mkrueger@xamarin.com>2013-08-19 19:00:11 +0400
committerMike Krüger <mkrueger@xamarin.com>2013-08-19 19:00:11 +0400
commit779f5cecc4d6da4dfde37c66c66880986c564b3e (patch)
tree863db89e07b3983dd30d9b76a2b4944c1c81e232 /main/src
parenta7f1d253a40cc6c4b91c82401f4be12f8cb1d567 (diff)
[Refactoring] Results marker are now added to the right location.
Diffstat (limited to 'main/src')
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultMarker.cs25
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs17
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/TextSegmentMarker.cs3
3 files changed, 38 insertions, 7 deletions
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultMarker.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultMarker.cs
index e78ad36b76..388fc67b77 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultMarker.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultMarker.cs
@@ -29,6 +29,7 @@ using MonoDevelop.SourceEditor;
using MonoDevelop.SourceEditor.QuickTasks;
using ICSharpCode.NRefactory.CSharp;
using ICSharpCode.NRefactory.Refactoring;
+using System.Collections.Generic;
namespace MonoDevelop.AnalysisCore.Gui
{
@@ -155,15 +156,35 @@ namespace MonoDevelop.AnalysisCore.Gui
}
#region IChunkMarker implementation
+
+ void IChunkMarker.TransformChunks (List<Chunk> chunks)
+ {
+ int markerStart = Segment.Offset;
+ int markerEnd = Segment.EndOffset;
+ for (int i = 0; i < chunks.Count; i++) {
+ var chunk = chunks [i];
+ if (chunk.EndOffset < markerStart || markerEnd <= chunk.Offset)
+ continue;
+ if (chunk.Offset == markerStart && chunk.EndOffset == markerEnd)
+ return;
+ if (chunk.Offset < markerStart && chunk.EndOffset > markerEnd) {
+ var newChunk = new Chunk (chunk.Offset, markerStart - chunk.Offset, chunk.Style);
+ chunks.Insert (i, newChunk);
+ chunk.Offset += newChunk.Length;
+ chunk.Length -= newChunk.Length;
+ continue;
+ }
+ }
+ }
+
void IChunkMarker.ChangeForeColor (TextEditor editor, Chunk chunk, ref Cairo.Color color)
{
if (Debugger.DebuggingService.IsDebugging)
return;
int markerStart = Segment.Offset;
int markerEnd = Segment.EndOffset;
- if (chunk.EndOffset < markerStart || markerEnd <= chunk.Offset)
+ if (chunk.EndOffset <= markerStart || markerEnd <= chunk.Offset)
return;
-
var bgc = editor.ColorStyle.PlainText.Background;
double alpha = 0.6;
color = new Cairo.Color (
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs
index 339cf32bfc..e5d7da0027 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs
@@ -918,6 +918,14 @@ namespace Mono.TextEditor
}
StringBuilder textBuilder = new StringBuilder ();
var chunks = GetCachedChunks (mode, Document, textEditor.ColorStyle, line, offset, length);
+ var markers = Document.GetTextSegmentMarkersAt (line).Where (m => m.IsVisible).ToArray ();
+ foreach (var marker in markers) {
+ var chunkMarker = marker as IChunkMarker;
+ if (chunkMarker == null)
+ continue;
+ chunkMarker.TransformChunks (chunks);
+ }
+
wrapper.Chunks = chunks;
foreach (var chunk in chunks) {
try {
@@ -956,7 +964,6 @@ namespace Mono.TextEditor
uint startIndex = (uint)(oldEndIndex);
uint endIndex = (uint)(startIndex + chunk.Length);
oldEndIndex = endIndex;
- var markers = Document.GetTextSegmentMarkersAt (line).Where (m => m.IsVisible).ToArray ();
HandleSelection (lineOffset, logicalRulerColumn, selectionStart, selectionEnd, chunk.Offset, chunk.EndOffset, delegate(int start, int end) {
if (containsPreedit) {
if (textEditor.preeditOffset < start)
@@ -1117,12 +1124,12 @@ namespace Mono.TextEditor
class ChunkDescriptor : LineDescriptor
{
- public Chunk[] Chunk {
+ public List<Chunk> Chunk {
get;
private set;
}
- public ChunkDescriptor (DocumentLine line, int offset, int length, Chunk[] chunk) : base(line, offset, length)
+ public ChunkDescriptor (DocumentLine line, int offset, int length, List<Chunk> chunk) : base(line, offset, length)
{
this.Chunk = chunk;
}
@@ -1130,7 +1137,7 @@ namespace Mono.TextEditor
Dictionary<DocumentLine, ChunkDescriptor> chunkDict = new Dictionary<DocumentLine, ChunkDescriptor> ();
- IEnumerable<Chunk> GetCachedChunks (ISyntaxMode mode, TextDocument doc, Mono.TextEditor.Highlighting.ColorScheme style, DocumentLine line, int offset, int length)
+ List<Chunk> GetCachedChunks (ISyntaxMode mode, TextDocument doc, Mono.TextEditor.Highlighting.ColorScheme style, DocumentLine line, int offset, int length)
{
ChunkDescriptor descriptor;
if (chunkDict.TryGetValue (line, out descriptor)) {
@@ -1140,7 +1147,7 @@ namespace Mono.TextEditor
chunkDict.Remove (line);
}
- Chunk[] chunks = mode.GetChunks (style, line, offset, length).ToArray ();
+ var chunks = mode.GetChunks (style, line, offset, length).ToList ();
descriptor = new ChunkDescriptor (line, offset, length, chunks);
chunkDict [line] = descriptor;
return chunks;
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/TextSegmentMarker.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/TextSegmentMarker.cs
index 4e2c7c5a80..cb2c35d223 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/TextSegmentMarker.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/TextSegmentMarker.cs
@@ -26,6 +26,7 @@
using System;
using Cairo;
using Mono.TextEditor.Highlighting;
+using System.Collections.Generic;
namespace Mono.TextEditor
{
@@ -64,6 +65,8 @@ namespace Mono.TextEditor
public interface IChunkMarker
{
+ void TransformChunks (List<Chunk> chunks);
+
void ChangeForeColor (TextEditor editor, Chunk chunk, ref Cairo.Color color);
}