From 839a5cbc8da489130dbe45e40253fe2be5d78c7e Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sun, 17 Jul 2011 14:17:02 +0200 Subject: [PATCH] Make AvalonEdit implement the ICSharpCode.Editor interfaces. --- .../CodeCompletion/CompletionWindowBase.cs | 4 +- .../CodeCompletion/ICompletionData.cs | 2 +- .../Document/ChangeTrackingCheckpoint.cs | 36 +- .../Document/DocumentChangeEventArgs.cs | 39 +-- .../Document/DocumentLine.cs | 4 +- .../Document/ITextSource.cs | 320 ------------------ .../Document/NewLineFinder.cs | 3 +- .../Document/OffsetChangeMap.cs | 1 + .../Document/RopeTextSource.cs | 103 ++++++ .../{ISegment.cs => SimpleSegment.cs} | 59 +--- .../Document/TextAnchor.cs | 26 +- .../Document/TextAnchorTree.cs | 1 + .../Document/TextDocument.cs | 101 +++++- .../Document/TextLocation.cs | 166 --------- .../Document/TextSegment.cs | 1 + .../Document/TextSegmentCollection.cs | 4 +- .../Document/TextUtilities.cs | 2 + .../ICSharpCode.AvalonEdit/Editing/Caret.cs | 8 +- .../Editing/EditingCommandHandler.cs | 2 +- .../Editing/IReadOnlySectionProvider.cs | 2 +- .../Editing/NoReadOnlySections.cs | 5 +- .../Editing/RectangleSelection.cs | 2 +- .../Editing/Selection.cs | 1 + .../Editing/SelectionColorizer.cs | 3 +- .../Editing/SelectionMouseHandler.cs | 1 + .../Editing/SimpleSelection.cs | 3 +- .../Editing/TextArea.cs | 4 +- .../TextSegmentReadOnlySectionProvider.cs | 1 + .../Folding/AbstractFoldingStrategy.cs | 2 +- .../Folding/FoldingElementGenerator.cs | 1 + .../Folding/FoldingManager.cs | 2 - .../Folding/FoldingSection.cs | 1 - .../Folding/NewFolding.cs | 10 +- .../Highlighting/HighlightedLine.cs | 4 +- .../Highlighting/HighlightedSection.cs | 2 +- .../Highlighting/HtmlClipboard.cs | 3 +- .../ICSharpCode.AvalonEdit.csproj | 11 +- .../Indentation/DefaultIndentationStrategy.cs | 2 +- .../Rendering/BackgroundGeometryBuilder.cs | 2 +- .../Rendering/TextView.cs | 1 + .../Snippets/IActiveElement.cs | 3 +- .../Snippets/InsertionContext.cs | 3 +- .../Snippets/Snippet.cs | 5 +- .../Snippets/SnippetAnchorElement.cs | 1 + .../Snippets/SnippetBoundElement.cs | 3 +- .../Snippets/SnippetCaretElement.cs | 2 +- .../Snippets/SnippetContainerElement.cs | 2 - .../Snippets/SnippetElement.cs | 4 - .../Snippets/SnippetInputHandler.cs | 4 +- .../Snippets/SnippetReplaceableTextElement.cs | 2 +- .../Snippets/SnippetSelectionElement.cs | 2 - .../Snippets/SnippetTextElement.cs | 1 - .../TextViewPosition.cs | 2 +- 53 files changed, 307 insertions(+), 672 deletions(-) delete mode 100644 src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ITextSource.cs create mode 100644 src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/RopeTextSource.cs rename src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/{ISegment.cs => SimpleSegment.cs} (80%) delete mode 100644 src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextLocation.cs diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/CompletionWindowBase.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/CompletionWindowBase.cs index c55fdf9fed..b036904290 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/CompletionWindowBase.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/CompletionWindowBase.cs @@ -2,16 +2,18 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Linq; using System.Diagnostics; +using System.Linq; using System.Windows; using System.Windows.Controls.Primitives; using System.Windows.Input; using System.Windows.Threading; + using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Editing; using ICSharpCode.AvalonEdit.Rendering; using ICSharpCode.AvalonEdit.Utils; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.CodeCompletion { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/ICompletionData.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/ICompletionData.cs index bcc9a7fa69..7f971fab40 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/ICompletionData.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/ICompletionData.cs @@ -3,8 +3,8 @@ using System; using System.Windows.Media; -using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Editing; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.CodeCompletion { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ChangeTrackingCheckpoint.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ChangeTrackingCheckpoint.cs index 2ad6a789b4..2e17b9d0d5 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ChangeTrackingCheckpoint.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ChangeTrackingCheckpoint.cs @@ -1,12 +1,14 @@ // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) -using ICSharpCode.AvalonEdit.Utils; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using ICSharpCode.AvalonEdit.Utils; +using ICSharpCode.Editor; + namespace ICSharpCode.AvalonEdit.Document { /// @@ -20,8 +22,10 @@ namespace ICSharpCode.AvalonEdit.Document /// Once you have two checkpoints, you can call to retrieve the complete list /// of document changes that happened between those versions of the document. /// - public sealed class ChangeTrackingCheckpoint + public sealed class ChangeTrackingCheckpoint : ITextSourceVersion { + static readonly ChangeTrackingCheckpoint checkpointBelongsToNoDocument = new ChangeTrackingCheckpoint(null); + // Object that is unique per document. // Used to determine if two checkpoints belong to the same document. // We don't use a reference to the document itself to allow the GC to reclaim the document memory @@ -136,5 +140,33 @@ namespace ICSharpCode.AvalonEdit.Document } return offset; } + + static ChangeTrackingCheckpoint GetCheckPoint(ITextSourceVersion version) + { + if (version == null) + return null; + else + return version as ChangeTrackingCheckpoint ?? checkpointBelongsToNoDocument; + } + + bool ITextSourceVersion.BelongsToSameDocumentAs(ITextSourceVersion other) + { + return BelongsToSameDocumentAs(GetCheckPoint(other)); + } + + int ITextSourceVersion.CompareAge(ITextSourceVersion other) + { + return CompareAge(GetCheckPoint(other)); + } + + IEnumerable ITextSourceVersion.GetChangesTo(ITextSourceVersion other) + { + return GetChangesTo(GetCheckPoint(other)); + } + + int ITextSourceVersion.MoveOffsetTo(ITextSourceVersion other, int oldOffset, AnchorMovementType movement) + { + return MoveOffsetTo(GetCheckPoint(other), oldOffset, movement); + } } } diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/DocumentChangeEventArgs.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/DocumentChangeEventArgs.cs index acf1831a61..ad43ea9f2f 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/DocumentChangeEventArgs.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/DocumentChangeEventArgs.cs @@ -1,8 +1,9 @@ // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) -using ICSharpCode.AvalonEdit.Utils; using System; +using ICSharpCode.AvalonEdit.Utils; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Document { @@ -11,37 +12,8 @@ namespace ICSharpCode.AvalonEdit.Document /// This class is thread-safe. /// [Serializable] - public class DocumentChangeEventArgs : EventArgs + public class DocumentChangeEventArgs : TextChangeEventArgs { - /// - /// The offset at which the change occurs. - /// - public int Offset { get; private set; } - - /// - /// The text that was inserted. - /// - public string RemovedText { get; private set; } - - /// - /// The number of characters removed. - /// - public int RemovalLength { - get { return RemovedText.Length; } - } - - /// - /// The text that was inserted. - /// - public string InsertedText { get; private set; } - - /// - /// The number of characters inserted. - /// - public int InsertionLength { - get { return InsertedText.Length; } - } - volatile OffsetChangeMap offsetChangeMap; /// @@ -97,15 +69,12 @@ namespace ICSharpCode.AvalonEdit.Document /// Creates a new DocumentChangeEventArgs object. /// public DocumentChangeEventArgs(int offset, string removedText, string insertedText, OffsetChangeMap offsetChangeMap) + : base(offset, removedText, insertedText) { ThrowUtil.CheckNotNegative(offset, "offset"); ThrowUtil.CheckNotNull(removedText, "removedText"); ThrowUtil.CheckNotNull(insertedText, "insertedText"); - this.Offset = offset; - this.RemovedText = removedText; - this.InsertedText = insertedText; - if (offsetChangeMap != null) { if (!offsetChangeMap.IsFrozen) throw new ArgumentException("The OffsetChangeMap must be frozen before it can be used in DocumentChangeEventArgs"); diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/DocumentLine.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/DocumentLine.cs index 0b6d00e453..794a2241f1 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/DocumentLine.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/DocumentLine.cs @@ -5,6 +5,8 @@ using System; using System.Diagnostics; using System.Globalization; +using ICSharpCode.Editor; + namespace ICSharpCode.AvalonEdit.Document { /// @@ -22,7 +24,7 @@ namespace ICSharpCode.AvalonEdit.Document /// and the data structure also updates all offsets in O(lg N) whenever a line is inserted or removed. /// /// - public sealed partial class DocumentLine : ISegment + public sealed partial class DocumentLine : IDocumentLine { #region Constructor #if DEBUG diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ITextSource.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ITextSource.cs deleted file mode 100644 index dd32422401..0000000000 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ITextSource.cs +++ /dev/null @@ -1,320 +0,0 @@ -// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) -// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) - -using ICSharpCode.AvalonEdit.Utils; -using System; -using System.IO; - -namespace ICSharpCode.AvalonEdit.Document -{ - /// - /// Interface for read-only access to a text source. - /// - /// - /// - public interface ITextSource - { - /// - /// Gets the whole text as string. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods")] - string Text { get; } - - /// - /// Is raised when the Text property changes. - /// - event EventHandler TextChanged; - - /// - /// Gets the total text length. - /// - /// The length of the text, in characters. - /// This is the same as Text.Length, but is more efficient because - /// it doesn't require creating a String object. - int TextLength { get; } - - /// - /// Gets a character at the specified position in the document. - /// - /// The index of the character to get. - /// Offset is outside the valid range (0 to TextLength-1). - /// The character at the specified position. - /// This is the same as Text[offset], but is more efficient because - /// it doesn't require creating a String object. - char GetCharAt(int offset); - - /// - /// Gets the index of the first occurrence of any character in the specified array. - /// - /// - /// Start index of the search. - /// Length of the area to search. - /// The first index where any character was found; or -1 if no occurrence was found. - int IndexOfAny(char[] anyOf, int startIndex, int count); - - /// - /// Retrieves the text for a portion of the document. - /// - /// offset or length is outside the valid range. - /// This is the same as Text.Substring, but is more efficient because - /// it doesn't require creating a String object for the whole document. - string GetText(int offset, int length); - - /// - /// Creates a snapshot of the current text. - /// - /// - /// This method is generally not thread-safe when called on a mutable text buffer, but the resulting text buffer is immutable and thread-safe. - /// However, some implementing classes may provide additional thread-safety guarantees, see TextDocument.CreateSnapshot. - /// - ITextSource CreateSnapshot(); - - /// - /// Creates a snapshot of a part of the current text. - /// - /// - /// This method is generally not thread-safe when called on a mutable text buffer, but the resulting text buffer is immutable and thread-safe. - /// However, some implementing classes may provide additional thread-safety guarantees, see TextDocument.CreateSnapshot. - /// - ITextSource CreateSnapshot(int offset, int length); - - /// - /// Creates a text reader. - /// If the text is changed while a reader is active, the reader will continue to read from the old text version. - /// - TextReader CreateReader(); - } - - /// - /// Implements the ITextSource interface by wrapping another TextSource - /// and viewing only a part of the text. - /// - [Obsolete("This class will be removed in a future version of AvalonEdit")] - public sealed class TextSourceView : ITextSource - { - readonly ITextSource baseTextSource; - readonly ISegment viewedSegment; - - /// - /// Creates a new TextSourceView object. - /// - /// The base text source. - /// A text segment from the base text source - public TextSourceView(ITextSource baseTextSource, ISegment viewedSegment) - { - if (baseTextSource == null) - throw new ArgumentNullException("baseTextSource"); - if (viewedSegment == null) - throw new ArgumentNullException("viewedSegment"); - this.baseTextSource = baseTextSource; - this.viewedSegment = viewedSegment; - } - - /// - public event EventHandler TextChanged { - add { baseTextSource.TextChanged += value; } - remove { baseTextSource.TextChanged -= value; } - } - - /// - public string Text { - get { - return baseTextSource.GetText(viewedSegment.Offset, viewedSegment.Length); - } - } - - /// - public int TextLength { - get { return viewedSegment.Length; } - } - - /// - public char GetCharAt(int offset) - { - return baseTextSource.GetCharAt(viewedSegment.Offset + offset); - } - - /// - public string GetText(int offset, int length) - { - return baseTextSource.GetText(viewedSegment.Offset + offset, length); - } - - /// - public ITextSource CreateSnapshot() - { - return baseTextSource.CreateSnapshot(viewedSegment.Offset, viewedSegment.Length); - } - - /// - public ITextSource CreateSnapshot(int offset, int length) - { - return baseTextSource.CreateSnapshot(viewedSegment.Offset + offset, length); - } - - /// - public TextReader CreateReader() - { - return CreateSnapshot().CreateReader(); - } - - /// - public int IndexOfAny(char[] anyOf, int startIndex, int count) - { - int offset = viewedSegment.Offset; - int result = baseTextSource.IndexOfAny(anyOf, startIndex + offset, count); - return result >= 0 ? result - offset : result; - } - } - - /// - /// Implements the ITextSource interface using a string. - /// - public sealed class StringTextSource : ITextSource - { - readonly string text; - - /// - /// Creates a new StringTextSource. - /// - public StringTextSource(string text) - { - if (text == null) - throw new ArgumentNullException("text"); - this.text = text; - } - - // Text can never change - event EventHandler ITextSource.TextChanged { add {} remove {} } - - /// - public string Text { - get { return text; } - } - - /// - public int TextLength { - get { return text.Length; } - } - - /// - public char GetCharAt(int offset) - { - // GetCharAt must throw ArgumentOutOfRangeException, not IndexOutOfRangeException - if (offset < 0 || offset >= text.Length) - throw new ArgumentOutOfRangeException("offset", offset, "offset must be between 0 and " + (text.Length - 1)); - return text[offset]; - } - - /// - public string GetText(int offset, int length) - { - return text.Substring(offset, length); - } - - /// - public TextReader CreateReader() - { - return new StringReader(text); - } - - /// - public ITextSource CreateSnapshot() - { - return this; // StringTextSource already is immutable - } - - /// - public ITextSource CreateSnapshot(int offset, int length) - { - return new StringTextSource(text.Substring(offset, length)); - } - - /// - public int IndexOfAny(char[] anyOf, int startIndex, int count) - { - return text.IndexOfAny(anyOf, startIndex, count); - } - } - - /// - /// Implements the ITextSource interface using a rope. - /// - public sealed class RopeTextSource : ITextSource - { - readonly Rope rope; - - /// - /// Creates a new RopeTextSource. - /// - public RopeTextSource(Rope rope) - { - if (rope == null) - throw new ArgumentNullException("rope"); - this.rope = rope; - } - - /// - /// Returns a clone of the rope used for this text source. - /// - /// - /// RopeTextSource only publishes a copy of the contained rope to ensure that the underlying rope cannot be modified. - /// Unless the creator of the RopeTextSource still has a reference on the rope, RopeTextSource is immutable. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification="Not a property because it creates a clone")] - public Rope GetRope() - { - return rope.Clone(); - } - - // Change event is not supported - event EventHandler ITextSource.TextChanged { add {} remove {} } - - /// - public string Text { - get { return rope.ToString(); } - } - - /// - public int TextLength { - get { return rope.Length; } - } - - /// - public char GetCharAt(int offset) - { - return rope[offset]; - } - - /// - public string GetText(int offset, int length) - { - return rope.ToString(offset, length); - } - - /// - public TextReader CreateReader() - { - return new RopeTextReader(rope); - } - - /// - public ITextSource CreateSnapshot() - { - // we clone the underlying rope because the creator of the RopeTextSource might be modifying it - return new RopeTextSource(rope.Clone()); - } - - /// - public ITextSource CreateSnapshot(int offset, int length) - { - return new RopeTextSource(rope.GetRange(offset, length)); - } - - /// - public int IndexOfAny(char[] anyOf, int startIndex, int count) - { - return rope.IndexOfAny(anyOf, startIndex, count); - } - } -} diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/NewLineFinder.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/NewLineFinder.cs index 29b2aa8cdf..50185cfebc 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/NewLineFinder.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/NewLineFinder.cs @@ -2,9 +2,8 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Collections.Generic; -using System.Diagnostics; using System.Text; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Document { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/OffsetChangeMap.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/OffsetChangeMap.cs index 9ce98fc719..0a9e1964a5 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/OffsetChangeMap.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/OffsetChangeMap.cs @@ -7,6 +7,7 @@ using System.Collections.ObjectModel; using System.Diagnostics.CodeAnalysis; using ICSharpCode.AvalonEdit.Utils; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Document { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/RopeTextSource.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/RopeTextSource.cs new file mode 100644 index 0000000000..349e98d8f7 --- /dev/null +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/RopeTextSource.cs @@ -0,0 +1,103 @@ +// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) +// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) + +using System; +using System.IO; +using ICSharpCode.AvalonEdit.Utils; +using ICSharpCode.Editor; + +namespace ICSharpCode.AvalonEdit.Document +{ + /// + /// Implements the ITextSource interface using a rope. + /// + public sealed class RopeTextSource : ITextSource + { + readonly Rope rope; + + /// + /// Creates a new RopeTextSource. + /// + public RopeTextSource(Rope rope) + { + if (rope == null) + throw new ArgumentNullException("rope"); + this.rope = rope; + } + + /// + /// Returns a clone of the rope used for this text source. + /// + /// + /// RopeTextSource only publishes a copy of the contained rope to ensure that the underlying rope cannot be modified. + /// Unless the creator of the RopeTextSource still has a reference on the rope, RopeTextSource is immutable. + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification="Not a property because it creates a clone")] + public Rope GetRope() + { + return rope.Clone(); + } + + /// + public string Text { + get { return rope.ToString(); } + } + + /// + public int TextLength { + get { return rope.Length; } + } + + /// + public char GetCharAt(int offset) + { + return rope[offset]; + } + + /// + public string GetText(int offset, int length) + { + return rope.ToString(offset, length); + } + + /// + public TextReader CreateReader() + { + return new RopeTextReader(rope); + } + + /// + public TextReader CreateReader(int offset, int length) + { + return new RopeTextReader(rope.GetRange(offset, length)); + } + + /// + public ITextSource CreateSnapshot() + { + // we clone the underlying rope because the creator of the RopeTextSource might be modifying it + return new RopeTextSource(rope.Clone()); + } + + /// + public ITextSource CreateSnapshot(int offset, int length) + { + return new RopeTextSource(rope.GetRange(offset, length)); + } + + /// + public int IndexOfAny(char[] anyOf, int startIndex, int count) + { + return rope.IndexOfAny(anyOf, startIndex, count); + } + + ITextSourceVersion ITextSource.Version { + get { return null; } + } + + string ITextSource.GetText(ICSharpCode.Editor.ISegment segment) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ISegment.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/SimpleSegment.cs similarity index 80% rename from src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ISegment.cs rename to src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/SimpleSegment.cs index dfc7c0f964..810ee8c77b 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ISegment.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/SimpleSegment.cs @@ -3,73 +3,34 @@ using System; using System.Diagnostics; -using ICSharpCode.AvalonEdit.Utils; using System.Globalization; +using ICSharpCode.AvalonEdit.Utils; +using ICSharpCode.Editor; + namespace ICSharpCode.AvalonEdit.Document { /// - /// An (Offset,Length)-pair. + /// Represents a simple segment (Offset,Length pair) that is not automatically updated + /// on document changes. /// - /// - /// - public interface ISegment - { - /// - /// Gets the start offset of the segment. - /// - int Offset { get; } - - /// - /// Gets the length of the segment. - /// - /// Must not be negative. - int Length { get; } - - /// - /// Gets the end offset of the segment. - /// - /// EndOffset = Offset + Length; - int EndOffset { get; } - } - - static class SegmentExtensions + struct SimpleSegment : IEquatable, ISegment { - /// - /// Gets whether the segment contains the offset. - /// - /// - /// True, if offset is between segment.Start and segment.End (inclusive); otherwise, false. - /// - public static bool Contains(this ISegment segment, int offset) - { - int start = segment.Offset; - int end = start + segment.Length; - return offset >= start && offset <= end; - } + public static readonly SimpleSegment Invalid = new SimpleSegment(-1, -1); /// /// Gets the overlapping portion of the segments. /// Returns SimpleSegment.Invalid if the segments don't overlap. /// - public static SimpleSegment GetOverlap(this ISegment segment, ISegment other) + public static SimpleSegment GetOverlap(ISegment segment1, ISegment segment2) { - int start = Math.Max(segment.Offset, other.Offset); - int end = Math.Min(segment.EndOffset, other.EndOffset); + int start = Math.Max(segment1.Offset, segment2.Offset); + int end = Math.Min(segment1.EndOffset, segment2.EndOffset); if (end < start) return SimpleSegment.Invalid; else return new SimpleSegment(start, end - start); } - } - - /// - /// Represents a simple segment (Offset,Length pair) that is not automatically updated - /// on document changes. - /// - struct SimpleSegment : IEquatable, ISegment - { - public static readonly SimpleSegment Invalid = new SimpleSegment(-1, -1); public readonly int Offset, Length; diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextAnchor.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextAnchor.cs index 4d8a71d31c..a46e3a682d 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextAnchor.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextAnchor.cs @@ -3,6 +3,7 @@ using System; using ICSharpCode.AvalonEdit.Utils; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Document { @@ -33,7 +34,7 @@ namespace ICSharpCode.AvalonEdit.Document /// int newOffset = anchor.Offset; /// /// - public sealed class TextAnchor + public sealed class TextAnchor : ITextAnchor { readonly TextDocument document; internal TextAnchorNode node; @@ -168,27 +169,4 @@ namespace ICSharpCode.AvalonEdit.Document return "[TextAnchor Offset=" + Offset + "]"; } } - - /// - /// Defines how a text anchor moves. - /// - public enum AnchorMovementType - { - /// - /// When text is inserted at the anchor position, the type of the insertion - /// determines where the caret moves to. For normal insertions, the anchor will stay - /// behind the inserted text. - /// - Default, - /// - /// When text is inserted at the anchor position, the anchor will stay - /// before the inserted text. - /// - BeforeInsertion, - /// - /// When text is insered at the anchor position, the anchor will move - /// after the inserted text. - /// - AfterInsertion - } } diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextAnchorTree.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextAnchorTree.cs index c75950c74c..3442cb7ff9 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextAnchorTree.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextAnchorTree.cs @@ -7,6 +7,7 @@ using System.Diagnostics; using System.Text; using ICSharpCode.AvalonEdit.Utils; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Document { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextDocument.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextDocument.cs index 23ed66e594..2bc060ab8e 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextDocument.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextDocument.cs @@ -6,11 +6,11 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; -using System.Linq; using System.Globalization; -using System.Linq.Expressions; using System.Threading; + using ICSharpCode.AvalonEdit.Utils; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Document { @@ -22,7 +22,7 @@ namespace ICSharpCode.AvalonEdit.Document /// /// However, there is a single method that is thread-safe: (and its overloads). /// - public sealed class TextDocument : ITextSource, INotifyPropertyChanged + public sealed class TextDocument : IDocument, INotifyPropertyChanged { #region Thread ownership readonly object lockObject = new object(); @@ -196,6 +196,11 @@ namespace ICSharpCode.AvalonEdit.Document /// public event EventHandler TextChanged; + event EventHandler IDocument.ChangeCompleted { + add { this.TextChanged += value; } + remove { this.TextChanged -= value; } + } + /// public int TextLength { get { @@ -257,12 +262,27 @@ namespace ICSharpCode.AvalonEdit.Document /// public event EventHandler Changing; + // Unfortunately EventHandler is invariant, so we have to use two separate events + private event EventHandler textChanging; + + event EventHandler IDocument.TextChanging { + add { textChanging += value; } + remove { textChanging -= value; } + } + /// /// Is raised after the document has changed. /// /// public event EventHandler Changed; + private event EventHandler textChanged; + + event EventHandler IDocument.TextChanged { + add { textChanged += value; } + remove { textChanged -= value; } + } + /// /// Creates a snapshot of the current text. /// @@ -282,6 +302,17 @@ namespace ICSharpCode.AvalonEdit.Document } } + /// + /// Creates a snapshot of a part of the current text. + /// + /// + public ITextSource CreateSnapshot(int offset, int length) + { + lock (lockObject) { + return new RopeTextSource(rope.GetRange(offset, length)); + } + } + /// /// Creates a snapshot of the current text. /// Additionally, creates a checkpoint that allows tracking document changes. @@ -307,22 +338,23 @@ namespace ICSharpCode.AvalonEdit.Document } } - /// - /// Creates a snapshot of a part of the current text. - /// - /// - public ITextSource CreateSnapshot(int offset, int length) + ITextSourceVersion ITextSource.Version { + get { return CreateChangeTrackingCheckpoint(); } + } + + /// + public System.IO.TextReader CreateReader() { lock (lockObject) { - return new RopeTextSource(rope.GetRange(offset, length)); + return new RopeTextReader(rope); } } /// - public System.IO.TextReader CreateReader() + public System.IO.TextReader CreateReader(int offset, int length) { lock (lockObject) { - return new RopeTextReader(rope); + return new RopeTextReader(rope.GetRange(offset, length)); } } #endregion @@ -613,6 +645,8 @@ namespace ICSharpCode.AvalonEdit.Document // fire DocumentChanging event if (Changing != null) Changing(this, args); + if (textChanging != null) + textChanging(this, args); undoStack.Push(this, args); @@ -661,6 +695,8 @@ namespace ICSharpCode.AvalonEdit.Document // fire DocumentChanged event if (Changed != null) Changed(this, args); + if (textChanged != null) + textChanged(this, args); } #endregion @@ -684,6 +720,11 @@ namespace ICSharpCode.AvalonEdit.Document return lineTree.GetByNumber(number); } + IDocumentLine IDocument.GetLineByNumber(int lineNumber) + { + return GetLineByNumber(lineNumber); + } + /// /// Gets a document lines by offset. /// Runtime: O(log n) @@ -697,8 +738,14 @@ namespace ICSharpCode.AvalonEdit.Document } return lineTree.GetByOffset(offset); } + + IDocumentLine IDocument.GetLineByOffset(int offset) + { + return GetLineByOffset(offset); + } #endregion + #region GetOffset / GetLocation /// /// Gets the offset from a text location. /// @@ -731,7 +778,9 @@ namespace ICSharpCode.AvalonEdit.Document DocumentLine line = GetLineByOffset(offset); return new TextLocation(line.LineNumber, offset - line.Offset + 1); } + #endregion + #region Line Trackers readonly ObservableCollection lineTrackers = new ObservableCollection(); /// @@ -744,7 +793,9 @@ namespace ICSharpCode.AvalonEdit.Document return lineTrackers; } } + #endregion + #region UndoStack UndoStack undoStack; /// @@ -764,7 +815,9 @@ namespace ICSharpCode.AvalonEdit.Document } } } + #endregion + #region CreateAnchor /// /// Creates a new at the specified offset. /// @@ -778,6 +831,12 @@ namespace ICSharpCode.AvalonEdit.Document return anchorTree.CreateAnchor(offset); } + ITextAnchor IDocument.CreateAnchor(int offset) + { + return CreateAnchor(offset); + } + #endregion + #region LineCount /// /// Gets the total number of lines in the document. @@ -832,5 +891,25 @@ namespace ICSharpCode.AvalonEdit.Document #endif } #endregion + + void IDocument.Insert(int offset, string text, AnchorMovementType defaultAnchorMovementType) + { + throw new NotImplementedException(); + } + + void IDocument.StartUndoableAction() + { + throw new NotImplementedException(); + } + + void IDocument.EndUndoableAction() + { + throw new NotImplementedException(); + } + + IDisposable IDocument.OpenUndoGroup() + { + throw new NotImplementedException(); + } } } diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextLocation.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextLocation.cs deleted file mode 100644 index 6c1aaf0294..0000000000 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextLocation.cs +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) -// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) - -using System; -using System.Globalization; - -namespace ICSharpCode.AvalonEdit.Document -{ - /// - /// A line/column position. - /// Text editor lines/columns are counted started from one. - /// - /// - /// The document provides the methods and - /// to convert between offsets and TextLocations. - /// - public struct TextLocation : IComparable, IEquatable - { - /// - /// Represents no text location (0, 0). - /// - public static readonly TextLocation Empty = new TextLocation(0, 0); - - /// - /// Creates a TextLocation instance. - /// - /// Warning: the parameters are (line, column). - /// Not (column, line) as in ICSharpCode.TextEditor! - /// - /// - public TextLocation(int line, int column) - { - y = line; - x = column; - } - - int x, y; - - /// - /// Gets the line number. - /// - public int Line { - get { return y; } - } - - /// - /// Gets the column number. - /// - public int Column { - get { return x; } - } - - /// - /// Gets whether the TextLocation instance is empty. - /// - public bool IsEmpty { - get { - return x <= 0 && y <= 0; - } - } - - /// - /// Gets a string representation for debugging purposes. - /// - public override string ToString() - { - return string.Format(CultureInfo.InvariantCulture, "(Line {1}, Col {0})", this.x, this.y); - } - - /// - /// Gets a hash code. - /// - public override int GetHashCode() - { - return unchecked (87 * x.GetHashCode() ^ y.GetHashCode()); - } - - /// - /// Equality test. - /// - public override bool Equals(object obj) - { - if (!(obj is TextLocation)) return false; - return (TextLocation)obj == this; - } - - /// - /// Equality test. - /// - public bool Equals(TextLocation other) - { - return this == other; - } - - /// - /// Equality test. - /// - public static bool operator ==(TextLocation left, TextLocation right) - { - return left.x == right.x && left.y == right.y; - } - - /// - /// Inequality test. - /// - public static bool operator !=(TextLocation left, TextLocation right) - { - return left.x != right.x || left.y != right.y; - } - - /// - /// Compares two text locations. - /// - public static bool operator <(TextLocation left, TextLocation right) - { - if (left.y < right.y) - return true; - else if (left.y == right.y) - return left.x < right.x; - else - return false; - } - - /// - /// Compares two text locations. - /// - public static bool operator >(TextLocation left, TextLocation right) - { - if (left.y > right.y) - return true; - else if (left.y == right.y) - return left.x > right.x; - else - return false; - } - - /// - /// Compares two text locations. - /// - public static bool operator <=(TextLocation left, TextLocation right) - { - return !(left > right); - } - - /// - /// Compares two text locations. - /// - public static bool operator >=(TextLocation left, TextLocation right) - { - return !(left < right); - } - - /// - /// Compares two text locations. - /// - public int CompareTo(TextLocation other) - { - if (this == other) - return 0; - if (this < other) - return -1; - else - return 1; - } - } -} diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextSegment.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextSegment.cs index 9148c3e0ea..c122d3003e 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextSegment.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextSegment.cs @@ -3,6 +3,7 @@ using System; using System.Diagnostics; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Document { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextSegmentCollection.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextSegmentCollection.cs index ba01c884a6..aeaec6df7c 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextSegmentCollection.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextSegmentCollection.cs @@ -1,7 +1,6 @@ // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) -using ICSharpCode.AvalonEdit.Utils; using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -10,6 +9,9 @@ using System.Linq; using System.Text; using System.Windows; +using ICSharpCode.AvalonEdit.Utils; +using ICSharpCode.Editor; + namespace ICSharpCode.AvalonEdit.Document { /// diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextUtilities.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextUtilities.cs index 8f07596b8d..7256ae2fe5 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextUtilities.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextUtilities.cs @@ -5,6 +5,8 @@ using System; using System.Globalization; using System.Windows.Documents; +using ICSharpCode.Editor; + namespace ICSharpCode.AvalonEdit.Document { /// diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/Caret.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/Caret.cs index 98a2e67e6e..2fc9b4438e 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/Caret.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/Caret.cs @@ -12,13 +12,14 @@ using System.Windows.Threading; using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Rendering; using ICSharpCode.AvalonEdit.Utils; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Editing { /// /// Helper class with caret-related methods. /// - public sealed class Caret + public sealed class Caret : ITextEditorCaret { readonly TextArea textArea; readonly TextView textView; @@ -226,6 +227,11 @@ namespace ICSharpCode.AvalonEdit.Editing /// public event EventHandler PositionChanged; + event EventHandler ITextEditorCaret.LocationChanged { + add { this.PositionChanged += value; } + remove { this.PositionChanged -= value; } + } + bool raisePositionChangedOnUpdateFinished; void RaisePositionChanged() diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/EditingCommandHandler.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/EditingCommandHandler.cs index 15a9e9c37c..76cc35aba5 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/EditingCommandHandler.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/EditingCommandHandler.cs @@ -8,7 +8,6 @@ using System.Globalization; using System.IO; using System.Linq; using System.Runtime.InteropServices; -using System.Text; using System.Windows; using System.Windows.Documents; using System.Windows.Input; @@ -16,6 +15,7 @@ using System.Windows.Input; using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Highlighting; using ICSharpCode.AvalonEdit.Utils; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Editing { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/IReadOnlySectionProvider.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/IReadOnlySectionProvider.cs index 61940c07fb..ca1b882e10 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/IReadOnlySectionProvider.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/IReadOnlySectionProvider.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; -using ICSharpCode.AvalonEdit.Document; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Editing { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/NoReadOnlySections.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/NoReadOnlySections.cs index 4e6e8cc847..c5b5d2de1a 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/NoReadOnlySections.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/NoReadOnlySections.cs @@ -2,10 +2,11 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Linq; using System.Collections.Generic; -using ICSharpCode.AvalonEdit.Document; +using System.Linq; + using ICSharpCode.AvalonEdit.Utils; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Editing { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/RectangleSelection.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/RectangleSelection.cs index e66a34a42a..792ec97aee 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/RectangleSelection.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/RectangleSelection.cs @@ -8,7 +8,7 @@ using System.Linq; using System.Text; using ICSharpCode.AvalonEdit.Document; -using ICSharpCode.AvalonEdit.Utils; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Editing { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/Selection.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/Selection.cs index 40d4e6c7d1..55d3231156 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/Selection.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/Selection.cs @@ -8,6 +8,7 @@ using System.Windows; using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Highlighting; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Editing { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/SelectionColorizer.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/SelectionColorizer.cs index 253d3c1999..d947be27da 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/SelectionColorizer.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/SelectionColorizer.cs @@ -2,9 +2,8 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Windows; -using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Rendering; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Editing { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/SelectionMouseHandler.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/SelectionMouseHandler.cs index 3d1982a142..3f439ebb75 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/SelectionMouseHandler.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/SelectionMouseHandler.cs @@ -14,6 +14,7 @@ using System.Windows.Threading; using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Rendering; using ICSharpCode.AvalonEdit.Utils; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Editing { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/SimpleSelection.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/SimpleSelection.cs index 8dad5de4e8..d4ac9ff8a2 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/SimpleSelection.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/SimpleSelection.cs @@ -3,10 +3,9 @@ using System; using System.Collections.Generic; -using System.Linq; - using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Utils; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Editing { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/TextArea.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/TextArea.cs index a38fe7bfb9..470976c910 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/TextArea.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/TextArea.cs @@ -2,7 +2,6 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; using System.ComponentModel; @@ -11,16 +10,15 @@ using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; -using System.Windows.Data; using System.Windows.Input; using System.Windows.Media; -using System.Windows.Shapes; using System.Windows.Threading; using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Indentation; using ICSharpCode.AvalonEdit.Rendering; using ICSharpCode.AvalonEdit.Utils; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Editing { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/TextSegmentReadOnlySectionProvider.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/TextSegmentReadOnlySectionProvider.cs index 7a52e900f2..c6daf63146 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/TextSegmentReadOnlySectionProvider.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/TextSegmentReadOnlySectionProvider.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using ICSharpCode.AvalonEdit.Document; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Editing { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/AbstractFoldingStrategy.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/AbstractFoldingStrategy.cs index df39e00d85..599d68daa2 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/AbstractFoldingStrategy.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/AbstractFoldingStrategy.cs @@ -2,8 +2,8 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using ICSharpCode.AvalonEdit.Document; using System.Collections.Generic; +using ICSharpCode.AvalonEdit.Document; namespace ICSharpCode.AvalonEdit.Folding { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/FoldingElementGenerator.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/FoldingElementGenerator.cs index 4113a66510..0804f70b5f 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/FoldingElementGenerator.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/FoldingElementGenerator.cs @@ -7,6 +7,7 @@ using System.Windows; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.TextFormatting; + using ICSharpCode.AvalonEdit.Rendering; using ICSharpCode.AvalonEdit.Utils; diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/FoldingManager.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/FoldingManager.cs index 0dbf278a03..f95cf1b31a 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/FoldingManager.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/FoldingManager.cs @@ -6,12 +6,10 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Windows; -using System.Windows.Threading; using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Editing; using ICSharpCode.AvalonEdit.Rendering; -using ICSharpCode.AvalonEdit.Utils; namespace ICSharpCode.AvalonEdit.Folding { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/FoldingSection.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/FoldingSection.cs index 7df9196e98..8d17d31a65 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/FoldingSection.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/FoldingSection.cs @@ -2,7 +2,6 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Windows.Threading; using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Rendering; diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/NewFolding.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/NewFolding.cs index cdcb7e1297..f5aee3abfc 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/NewFolding.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/NewFolding.cs @@ -2,15 +2,7 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Windows; -using System.Windows.Threading; - -using ICSharpCode.AvalonEdit.Document; -using ICSharpCode.AvalonEdit.Editing; -using ICSharpCode.AvalonEdit.Rendering; -using ICSharpCode.AvalonEdit.Utils; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Folding { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightedLine.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightedLine.cs index cbeee2028d..142effe698 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightedLine.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightedLine.cs @@ -5,10 +5,10 @@ using System; using System.Collections.Generic; using System.Globalization; using System.IO; -using System.Text; using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Utils; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Highlighting { @@ -111,7 +111,7 @@ namespace ICSharpCode.AvalonEdit.Highlighting List elements = new List(); for (int i = 0; i < this.Sections.Count; i++) { HighlightedSection s = this.Sections[i]; - if (s.GetOverlap(requestedSegment).Length > 0) { + if (SimpleSegment.GetOverlap(s, requestedSegment).Length > 0) { elements.Add(new HtmlElement(s.Offset, i, false, s.Color)); elements.Add(new HtmlElement(s.Offset + s.Length, i, true, s.Color)); } diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightedSection.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightedSection.cs index 9725a20421..4b8910f481 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightedSection.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightedSection.cs @@ -2,7 +2,7 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using ICSharpCode.AvalonEdit.Document; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Highlighting { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HtmlClipboard.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HtmlClipboard.cs index 387ebd9f35..78e22c042a 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HtmlClipboard.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HtmlClipboard.cs @@ -9,6 +9,7 @@ using System.Text; using System.Windows; using ICSharpCode.AvalonEdit.Document; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Highlighting { @@ -86,7 +87,7 @@ namespace ICSharpCode.AvalonEdit.Highlighting highlightedLine = highlighter.HighlightLine(line.LineNumber); else highlightedLine = new HighlightedLine(document, line); - SimpleSegment s = segment.GetOverlap(line); + SimpleSegment s = SimpleSegment.GetOverlap(segment, line); if (html.Length > 0) html.AppendLine("
"); html.Append(highlightedLine.ToHtml(s.Offset, s.EndOffset, options)); diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj index a5e847ed38..3ae8b25541 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj @@ -102,8 +102,8 @@ UndoStack.cs - - + + UndoStack.cs @@ -123,7 +123,6 @@ TextAnchor.cs - @@ -412,4 +411,10 @@ + + + {F054A788-B591-4561-A8BA-AE745BBEB817} + ICSharpCode.Editor + + \ No newline at end of file diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Indentation/DefaultIndentationStrategy.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Indentation/DefaultIndentationStrategy.cs index 8fb7c31fff..9910078463 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Indentation/DefaultIndentationStrategy.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Indentation/DefaultIndentationStrategy.cs @@ -1,9 +1,9 @@ // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) -using ICSharpCode.AvalonEdit.Utils; using System; using ICSharpCode.AvalonEdit.Document; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Indentation { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/BackgroundGeometryBuilder.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/BackgroundGeometryBuilder.cs index 505f966ed8..dff044c33f 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/BackgroundGeometryBuilder.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/BackgroundGeometryBuilder.cs @@ -8,8 +8,8 @@ using System.Windows; using System.Windows.Media; using System.Windows.Media.TextFormatting; -using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Utils; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Rendering { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/TextView.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/TextView.cs index 68483921bb..ec4fe2ff9f 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/TextView.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/TextView.cs @@ -19,6 +19,7 @@ using System.Windows.Threading; using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Utils; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Rendering { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/IActiveElement.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/IActiveElement.cs index 8d0a9592f1..dbd10c19c2 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/IActiveElement.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/IActiveElement.cs @@ -2,8 +2,7 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Windows.Media; -using ICSharpCode.AvalonEdit.Document; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Snippets { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/InsertionContext.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/InsertionContext.cs index 7461f19c79..b616c5da10 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/InsertionContext.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/InsertionContext.cs @@ -4,11 +4,10 @@ using System; using System.Collections.Generic; using System.Windows; -using System.Windows.Input; using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Editing; -using ICSharpCode.AvalonEdit.Utils; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Snippets { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/Snippet.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/Snippet.cs index 7cfdb11d59..14409881b3 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/Snippet.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/Snippet.cs @@ -2,12 +2,9 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Collections.Generic; -using System.Windows.Documents; - using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Editing; -using ICSharpCode.AvalonEdit.Utils; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Snippets { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetAnchorElement.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetAnchorElement.cs index a76d233e3b..297dc24169 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetAnchorElement.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetAnchorElement.cs @@ -3,6 +3,7 @@ using System; using ICSharpCode.AvalonEdit.Document; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Snippets { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetBoundElement.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetBoundElement.cs index b322027c5c..d85bd9fc6c 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetBoundElement.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetBoundElement.cs @@ -4,6 +4,7 @@ using System; using System.Windows.Documents; using ICSharpCode.AvalonEdit.Document; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Snippets { @@ -91,7 +92,7 @@ namespace ICSharpCode.AvalonEdit.Snippets { // Don't copy text if the segments overlap (we would get an endless loop). // This can happen if the user deletes the text between the replaceable element and the bound element. - if (segment.GetOverlap(targetElement.Segment) == SimpleSegment.Invalid) { + if (SimpleSegment.GetOverlap(segment, targetElement.Segment) == SimpleSegment.Invalid) { int offset = segment.Offset; int length = segment.Length; string text = boundElement.ConvertText(targetElement.Text); diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetCaretElement.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetCaretElement.cs index d1060a6e87..143d2cacd4 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetCaretElement.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetCaretElement.cs @@ -2,8 +2,8 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Windows.Input; using ICSharpCode.AvalonEdit.Document; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Snippets { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetContainerElement.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetContainerElement.cs index 1ae584eccc..e03b3def83 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetContainerElement.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetContainerElement.cs @@ -3,10 +3,8 @@ using System; using System.Collections.Generic; -using System.Text; using System.Windows.Documents; -using ICSharpCode.AvalonEdit.Editing; using ICSharpCode.AvalonEdit.Utils; namespace ICSharpCode.AvalonEdit.Snippets diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetElement.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetElement.cs index 187192c7b4..53d2a43f49 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetElement.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetElement.cs @@ -2,12 +2,8 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Collections.Generic; using System.Windows.Documents; -using ICSharpCode.AvalonEdit.Editing; -using ICSharpCode.AvalonEdit.Utils; - namespace ICSharpCode.AvalonEdit.Snippets { /// diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetInputHandler.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetInputHandler.cs index 5925120615..b02891e795 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetInputHandler.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetInputHandler.cs @@ -2,12 +2,10 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Linq; using System.Collections.Generic; -using System.Diagnostics; +using System.Linq; using System.Windows.Input; -using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Editing; namespace ICSharpCode.AvalonEdit.Snippets diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetReplaceableTextElement.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetReplaceableTextElement.cs index 26c3f4d615..6f9598c6a5 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetReplaceableTextElement.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetReplaceableTextElement.cs @@ -6,10 +6,10 @@ using System.Linq; using System.Windows; using System.Windows.Documents; using System.Windows.Media; -using System.Windows.Threading; using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Rendering; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit.Snippets { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetSelectionElement.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetSelectionElement.cs index 135fa4a91b..a557ef4ca8 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetSelectionElement.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetSelectionElement.cs @@ -3,8 +3,6 @@ using System; using System.Text; -using System.Windows.Input; -using ICSharpCode.AvalonEdit.Document; namespace ICSharpCode.AvalonEdit.Snippets { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetTextElement.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetTextElement.cs index dc68f7bc1b..1a57c2e708 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetTextElement.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetTextElement.cs @@ -3,7 +3,6 @@ using System; using System.Windows.Documents; -using ICSharpCode.AvalonEdit.Document; namespace ICSharpCode.AvalonEdit.Snippets { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextViewPosition.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextViewPosition.cs index 36e6be79ee..9c33a64fe9 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextViewPosition.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextViewPosition.cs @@ -3,7 +3,7 @@ using System; using System.Globalization; -using ICSharpCode.AvalonEdit.Document; +using ICSharpCode.Editor; namespace ICSharpCode.AvalonEdit {