diff --git a/Directory.Build.props b/Directory.Build.props
index c21a30ab..41ffd0bf 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -2,7 +2,7 @@
latest
true
- 11.0.0-rc1.1
+ 11.0.0
1.0.55
beta
diff --git a/src/AvaloniaEdit.Demo/AvaloniaEdit.Demo.csproj b/src/AvaloniaEdit.Demo/AvaloniaEdit.Demo.csproj
index fe826f14..9edbb13d 100644
--- a/src/AvaloniaEdit.Demo/AvaloniaEdit.Demo.csproj
+++ b/src/AvaloniaEdit.Demo/AvaloniaEdit.Demo.csproj
@@ -33,7 +33,7 @@
-
+
diff --git a/src/AvaloniaEdit.TextMate/AvaloniaEdit.TextMate.csproj b/src/AvaloniaEdit.TextMate/AvaloniaEdit.TextMate.csproj
index c3e002d0..9490a8a2 100644
--- a/src/AvaloniaEdit.TextMate/AvaloniaEdit.TextMate.csproj
+++ b/src/AvaloniaEdit.TextMate/AvaloniaEdit.TextMate.csproj
@@ -12,7 +12,7 @@
-
+
diff --git a/src/AvaloniaEdit/Editing/TextArea.cs b/src/AvaloniaEdit/Editing/TextArea.cs
index ade1cb34..101986b3 100644
--- a/src/AvaloniaEdit/Editing/TextArea.cs
+++ b/src/AvaloniaEdit/Editing/TextArea.cs
@@ -73,7 +73,7 @@ static TextArea()
if (!ta.IsReadOnly)
{
e.Client = ta._imClient;
- }
+ }
});
}
@@ -627,7 +627,7 @@ public IDisposable AllowCaretOutsideSelection()
/// If the textview can be scrolled.
///
/// The line to scroll to.
- public void ScrollToLine (int line)
+ public void ScrollToLine(int line)
{
var viewPortLines = (int)(this as IScrollable).Viewport.Height;
@@ -1134,9 +1134,8 @@ public void RaiseScrollInvalidated(EventArgs e)
_logicalScrollable?.RaiseScrollInvalidated(e);
}
- private class TextAreaTextInputMethodClient : ITextInputMethodClient
+ private class TextAreaTextInputMethodClient : TextInputMethodClient
{
- private ITextEditable _textEditable;
private TextArea _textArea;
public TextAreaTextInputMethodClient()
@@ -1144,15 +1143,11 @@ public TextAreaTextInputMethodClient()
}
- public event EventHandler CursorRectangleChanged;
- public event EventHandler TextViewVisualChanged;
- public event EventHandler SurroundingTextChanged;
-
- public Rect CursorRectangle
+ public override Rect CursorRectangle
{
get
- {
- if(_textArea == null)
+ {
+ if (_textArea == null)
{
return default;
}
@@ -1170,97 +1165,75 @@ public Rect CursorRectangle
}
}
- public Visual TextViewVisual => _textArea;
+ public override Visual TextViewVisual => _textArea;
- public bool SupportsPreedit => false;
+ public override bool SupportsPreedit => false;
- public bool SupportsSurroundingText => true;
+ public override bool SupportsSurroundingText => true;
- public TextInputMethodSurroundingText SurroundingText
+ public override string SurroundingText
{
get
{
- if(_textArea == null)
+ if (_textArea == null)
{
return default;
}
var lineIndex = _textArea.Caret.Line;
- var position = _textArea.Caret.Position;
-
var documentLine = _textArea.Document.GetLineByNumber(lineIndex);
var text = _textArea.Document.GetText(documentLine.Offset, documentLine.Length);
- return new TextInputMethodSurroundingText
- {
- AnchorOffset = 0,
- CursorOffset = position.Column,
- Text = text
- };
+ return text;
}
}
- public ITextEditable TextEditable
+ public override TextSelection Selection
{
- get => _textEditable;
- set => _textEditable = value;
+ get => new TextSelection(_textArea.Caret.Position.Column, _textArea.Caret.Position.Column + _textArea.Selection.Length);
+ set
+ {
+ var selection = _textArea.Selection;
+
+ _textArea.Selection = selection.StartSelectionOrSetEndpoint(
+ new TextViewPosition(selection.StartPosition.Line, value.Start),
+ new TextViewPosition(selection.StartPosition.Line, value.End));
+ }
}
public void SetTextArea(TextArea textArea)
{
- if(_textArea != null)
+ if (_textArea != null)
{
_textArea.Caret.PositionChanged -= Caret_PositionChanged;
- _textArea.SelectionChanged -= TextArea_SelectionChanged;
}
_textArea = textArea;
- if(_textArea != null)
+ if (_textArea != null)
{
_textArea.Caret.PositionChanged += Caret_PositionChanged;
- _textArea.SelectionChanged += TextArea_SelectionChanged;
}
- TextViewVisualChanged?.Invoke(this, EventArgs.Empty);
+ RaiseTextViewVisualChanged();
- CursorRectangleChanged?.Invoke(this, EventArgs.Empty);
- }
-
- private void Caret_PositionChanged(object sender, EventArgs e)
- {
- CursorRectangleChanged?.Invoke(this, e);
- }
+ RaiseCursorRectangleChanged();
- private void TextArea_SelectionChanged(object sender, EventArgs e)
- {
- SurroundingTextChanged?.Invoke(this, e);
+ RaiseSurroundingTextChanged();
}
- public void SelectInSurroundingText(int start, int end)
+ private void Caret_PositionChanged(object sender, EventArgs e)
{
- if(_textArea == null)
- {
- return;
- }
-
- var selection = _textArea.Selection;
-
- _textArea.Selection = _textArea.Selection.StartSelectionOrSetEndpoint(
- new TextViewPosition(selection.StartPosition.Line, start),
- new TextViewPosition(selection.StartPosition.Line, end));
+ RaiseCursorRectangleChanged();
+ RaiseSurroundingTextChanged();
+ RaiseSelectionChanged();
}
- public void SetPreeditText(string text)
+ public override void SetPreeditText(string text)
{
-
- }
- public void SetComposingRegion(TextRange? region)
- {
- //ToDo
}
}
}
diff --git a/test/AvaloniaEdit.Tests/AvaloniaEdit.Tests.csproj b/test/AvaloniaEdit.Tests/AvaloniaEdit.Tests.csproj
index c1902d7c..3893f397 100644
--- a/test/AvaloniaEdit.Tests/AvaloniaEdit.Tests.csproj
+++ b/test/AvaloniaEdit.Tests/AvaloniaEdit.Tests.csproj
@@ -6,8 +6,8 @@
-
-
+
+