Skip to content

Commit 5a8c469

Browse files
committed
Fix cursor jump issue in MetroRichTextBox
1 parent 2519d79 commit 5a8c469

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/ReaLTaiizor/Controls/RichTextBox/MetroRichTextBox.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,11 @@ private void T_KeyDown(object sender, KeyEventArgs e)
400400

401401
private void T_TextChanged(object sender, EventArgs e)
402402
{
403+
int cursorPosition = _richTextBox.SelectionStart; // Save the current cursor position
403404
Text = _richTextBox.Text;
404405
TextChanged?.Invoke(this);
406+
_richTextBox.SelectionStart = cursorPosition; // Restore the cursor position
407+
_richTextBox.SelectionLength = 0; // Ensure no text is selected
405408
Invalidate();
406409
}
407410

0 commit comments

Comments
 (0)