feat: add force disconnect handling and improve user ban notifications

This commit is contained in:
HueByte
2026-02-19 22:09:54 +01:00
parent 7a8b5f02d3
commit 107152298e
3 changed files with 47 additions and 7 deletions
+26
View File
@@ -197,6 +197,7 @@ public sealed class MainWindow : Runnable
WordWrap = true
};
_inputField.KeyDown += OnInputKeyDown;
_inputField.ContentsChanged += OnInputContentsChanged;
_inputFrame.Add(_inputField);
Add(_inputFrame);
@@ -388,6 +389,31 @@ public sealed class MainWindow : Runnable
}
}
private bool _suppressEmojiReplace;
private void OnInputContentsChanged(object? sender, ContentsChangedEventArgs e)
{
if (_suppressEmojiReplace)
return;
var text = _inputField.Text;
if (string.IsNullOrEmpty(text))
return;
var replaced = EmojiHelper.ReplaceEmoji(text);
if (replaced == text)
return;
// Calculate where cursor should land after replacement
var lengthDelta = replaced.Length - text.Length;
var newCol = Math.Max(0, _inputField.CurrentColumn + lengthDelta);
_suppressEmojiReplace = true;
_inputField.Text = replaced;
_inputField.InsertionPoint = new System.Drawing.Point(newCol, _inputField.CurrentRow);
_suppressEmojiReplace = false;
}
/// <summary>
/// Tab-complete slash commands in the input field.
/// </summary>