Browse Source

Fixed SD2-1597 - Double click selection does not select entire word with error highlighting

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5412 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Daniel Grunwald 16 years ago
parent
commit
404042e3ce
  1. 1
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ITextSource.cs
  2. 4
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextUtilities.cs
  3. 3
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/UndoStack.cs
  4. 12
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/VisualLine.cs
  5. 15
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/VisualLineText.cs
  6. 1
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/Deque.cs

1
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ITextSource.cs

@ -78,6 +78,7 @@ namespace ICSharpCode.AvalonEdit.Document @@ -78,6 +78,7 @@ namespace ICSharpCode.AvalonEdit.Document
/// Implements the ITextSource interface by wrapping another TextSource
/// and viewing only a part of the text.
/// </summary>
[Obsolete("This class will be removed in a future version of AvalonEdit")]
public sealed class TextSourceView : ITextSource
{
readonly ITextSource baseTextSource;

4
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextUtilities.cs

@ -243,8 +243,8 @@ namespace ICSharpCode.AvalonEdit.Document @@ -243,8 +243,8 @@ namespace ICSharpCode.AvalonEdit.Document
/// in the text source.</returns>
/// <remarks>
/// This method is NOT equivalent to the actual caret movement when using VisualLine.GetNextCaretPosition.
/// In real caret movement, there are additional caret stops at line starts and ends. However, this method
/// doesn't know anything about lines: it is often called with a textSource that represents only a single VisualTextElement.
/// In real caret movement, there are additional caret stops at line starts and ends. This method
/// treats linefeeds as simple whitespace.
/// </remarks>
public static int GetNextCaretPosition(ITextSource textSource, int offset, LogicalDirection direction, CaretPositioningMode mode)
{

3
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/UndoStack.cs

@ -22,7 +22,7 @@ namespace ICSharpCode.AvalonEdit.Document @@ -22,7 +22,7 @@ namespace ICSharpCode.AvalonEdit.Document
Deque<IUndoableOperation> undostack = new Deque<IUndoableOperation>();
Deque<IUndoableOperation> redostack = new Deque<IUndoableOperation>();
int sizeLimit = 1000;
int sizeLimit = int.MaxValue;
bool acceptChanges = true;
/// <summary>
@ -51,7 +51,6 @@ namespace ICSharpCode.AvalonEdit.Document @@ -51,7 +51,6 @@ namespace ICSharpCode.AvalonEdit.Document
/// <summary>
/// Gets/Sets the limit on the number of items on the undo stack.
/// The default value is 1000.
/// </summary>
/// <remarks>The size limit is enforced only on the number of stored top-level undo groups.
/// Elements within undo groups do not count towards the size limit.</remarks>

12
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/VisualLine.cs

@ -52,6 +52,16 @@ namespace ICSharpCode.AvalonEdit.Rendering @@ -52,6 +52,16 @@ namespace ICSharpCode.AvalonEdit.Rendering
/// </summary>
public ReadOnlyCollection<TextLine> TextLines { get; private set; }
/// <summary>
/// Gets the start offset of the VisualLine inside the document.
/// This is equivalent to <c>FirstDocumentLine.Offset</c>.
/// </summary>
public int StartOffset {
get {
return FirstDocumentLine.Offset;
}
}
/// <summary>
/// Length in visual line coordinates.
/// </summary>
@ -334,7 +344,7 @@ namespace ICSharpCode.AvalonEdit.Rendering @@ -334,7 +344,7 @@ namespace ICSharpCode.AvalonEdit.Rendering
if (direction == LogicalDirection.Backward) {
// Search Backwards:
// If the last element doesn't handle line borders, return the line end as caret stop
// (we don't check the mode here: we treat a line end as word start, border, etc.
if (visualColumn > this.VisualLength && !elements[elements.Count-1].HandlesLineBorders && HasImplicitStopAtLineEnd(mode)) {
return this.VisualLength;
}

15
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/VisualLineText.cs

@ -90,21 +90,18 @@ namespace ICSharpCode.AvalonEdit.Rendering @@ -90,21 +90,18 @@ namespace ICSharpCode.AvalonEdit.Rendering
/// <inheritdoc/>
public override int GetVisualColumn(int relativeTextOffset)
{
return VisualColumn + relativeTextOffset - this.RelativeTextOffset;
return this.VisualColumn + relativeTextOffset - this.RelativeTextOffset;
}
/// <inheritdoc/>
public override int GetNextCaretPosition(int visualColumn, LogicalDirection direction, CaretPositioningMode mode)
{
int textOffset = parentVisualLine.FirstDocumentLine.Offset + this.RelativeTextOffset;
TextSourceView view = new TextSourceView(
parentVisualLine.Document,
new SimpleSegment(textOffset, this.DocumentLength));
int pos = TextUtilities.GetNextCaretPosition(view, visualColumn - this.VisualColumn, direction, mode);
if (pos < 0)
return pos;
int textOffset = parentVisualLine.StartOffset + this.RelativeTextOffset;
int pos = TextUtilities.GetNextCaretPosition(parentVisualLine.Document, textOffset + visualColumn - this.VisualColumn, direction, mode);
if (pos < textOffset || pos > textOffset + this.DocumentLength)
return -1;
else
return this.VisualColumn + pos;
return this.VisualColumn + pos - textOffset;
}
}
}

1
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/Deque.cs

@ -15,6 +15,7 @@ namespace ICSharpCode.AvalonEdit.Utils @@ -15,6 +15,7 @@ namespace ICSharpCode.AvalonEdit.Utils
/// Double-ended queue.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[Serializable]
public class Deque<T> : ICollection<T>
{
T[] arr = Empty<T>.Array;

Loading…
Cancel
Save