mirror of
https://github.com/2dust/v2rayN.git
synced 2025-10-13 20:09:12 +00:00
Update MsgView.axaml.cs
This commit is contained in:
parent
e9daf26bcf
commit
d4d47b0d26
1 changed files with 6 additions and 1 deletions
|
@ -47,7 +47,9 @@ public partial class MsgView : ReactiveUserControl<MsgViewModel>
|
||||||
{
|
{
|
||||||
var newText = msg?.ToString() ?? string.Empty;
|
var newText = msg?.ToString() ?? string.Empty;
|
||||||
|
|
||||||
if (txtMsg.Text is { } old && newText.Length >= _lastShownLength && newText.AsSpan(0, _lastShownLength).SequenceEqual(old))
|
if (txtMsg.Text is { } old &&
|
||||||
|
newText.Length >= _lastShownLength &&
|
||||||
|
newText.AsSpan(0, _lastShownLength).SequenceEqual(old))
|
||||||
{
|
{
|
||||||
var delta = newText.AsSpan(_lastShownLength);
|
var delta = newText.AsSpan(_lastShownLength);
|
||||||
if (!delta.IsEmpty)
|
if (!delta.IsEmpty)
|
||||||
|
@ -61,15 +63,18 @@ public partial class MsgView : ReactiveUserControl<MsgViewModel>
|
||||||
_lastShownLength = txtMsg.Text.Length;
|
_lastShownLength = txtMsg.Text.Length;
|
||||||
|
|
||||||
if (togScrollToEnd.IsChecked ?? true)
|
if (togScrollToEnd.IsChecked ?? true)
|
||||||
|
{
|
||||||
Avalonia.Threading.Dispatcher.UIThread.Post(
|
Avalonia.Threading.Dispatcher.UIThread.Post(
|
||||||
() => _scrollViewer?.ScrollToEnd(),
|
() => _scrollViewer?.ScrollToEnd(),
|
||||||
Avalonia.Threading.DispatcherPriority.Render);
|
Avalonia.Threading.DispatcherPriority.Render);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearMsg()
|
public void ClearMsg()
|
||||||
{
|
{
|
||||||
ViewModel?.ClearMsg();
|
ViewModel?.ClearMsg();
|
||||||
txtMsg.Text = "";
|
txtMsg.Text = "";
|
||||||
|
_lastShownLength = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void menuMsgViewSelectAll_Click(object? sender, RoutedEventArgs e)
|
private void menuMsgViewSelectAll_Click(object? sender, RoutedEventArgs e)
|
||||||
|
|
Loading…
Reference in a new issue