|
|
@ -13,7 +13,6 @@ namespace Avalonia.Controls |
|
|
private TextPresenter? _presenter; |
|
|
private TextPresenter? _presenter; |
|
|
private bool _selectionChanged; |
|
|
private bool _selectionChanged; |
|
|
private bool _isInChange; |
|
|
private bool _isInChange; |
|
|
private ITextInputMethodImpl? _im; |
|
|
|
|
|
|
|
|
|
|
|
public override Visual TextViewVisual => _presenter!; |
|
|
public override Visual TextViewVisual => _presenter!; |
|
|
|
|
|
|
|
|
@ -119,6 +118,7 @@ namespace Avalonia.Controls |
|
|
if (_parent != null) |
|
|
if (_parent != null) |
|
|
{ |
|
|
{ |
|
|
_parent.PropertyChanged -= OnParentPropertyChanged; |
|
|
_parent.PropertyChanged -= OnParentPropertyChanged; |
|
|
|
|
|
_parent.Tapped -= OnParentTapped; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
_parent = parent; |
|
|
_parent = parent; |
|
|
@ -126,11 +126,7 @@ namespace Avalonia.Controls |
|
|
if (_parent != null) |
|
|
if (_parent != null) |
|
|
{ |
|
|
{ |
|
|
_parent.PropertyChanged += OnParentPropertyChanged; |
|
|
_parent.PropertyChanged += OnParentPropertyChanged; |
|
|
_im = (_parent.VisualRoot as ITextInputMethodRoot)?.InputMethod; |
|
|
_parent.Tapped += OnParentTapped; |
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
_im = null; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var oldPresenter = _presenter; |
|
|
var oldPresenter = _presenter; |
|
|
@ -154,6 +150,11 @@ namespace Avalonia.Controls |
|
|
RaiseCursorRectangleChanged(); |
|
|
RaiseCursorRectangleChanged(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void OnParentTapped(object? sender, Input.TappedEventArgs e) |
|
|
|
|
|
{ |
|
|
|
|
|
RaiseInputPaneActivationRequested(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public override void SetPreeditText(string? preeditText) => SetPreeditText(preeditText, null); |
|
|
public override void SetPreeditText(string? preeditText) => SetPreeditText(preeditText, null); |
|
|
|
|
|
|
|
|
public override void SetPreeditText(string? preeditText, int? cursorPos) |
|
|
public override void SetPreeditText(string? preeditText, int? cursorPos) |
|
|
@ -167,17 +168,6 @@ namespace Avalonia.Controls |
|
|
_presenter.SetCurrentValue(TextPresenter.PreeditTextCursorPositionProperty, cursorPos); |
|
|
_presenter.SetCurrentValue(TextPresenter.PreeditTextCursorPositionProperty, cursorPos); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public override void ShowInputPanel() |
|
|
|
|
|
{ |
|
|
|
|
|
base.ShowInputPanel(); |
|
|
|
|
|
|
|
|
|
|
|
if (_parent is { } && _im is { }) |
|
|
|
|
|
{ |
|
|
|
|
|
_im.SetOptions(TextInputOptions.FromStyledElement(_parent)); |
|
|
|
|
|
_im.SetClient(this); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static string GetTextLineText(TextLine textLine) |
|
|
private static string GetTextLineText(TextLine textLine) |
|
|
{ |
|
|
{ |
|
|
if (textLine.Length == 0) |
|
|
if (textLine.Length == 0) |
|
|
|