Skip to content

Commit 0bb33a1

Browse files
BenTrolldemorted
authored andcommitted
probably fix inserting newlines at the right position
1 parent 3a43eae commit 0bb33a1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Signal-Windows/Controls/UserInput.xaml.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@ public string InputText
4141

4242
public void AddLinefeed()
4343
{
44-
InputTextBox.Text += "\r";
45-
InputTextBox.SelectionStart = InputTextBox.Text.Length;
44+
string prefix = InputTextBox.Text.Substring(0, InputTextBox.SelectionStart);
45+
string suffix = InputTextBox.Text.Substring(InputTextBox.SelectionStart);
46+
var pos = InputTextBox.SelectionStart;
47+
InputTextBox.Text = prefix + "\r" + suffix;
48+
InputTextBox.SelectionStart = pos + 1;
4649
InputTextBox.SelectionLength = 0;
4750
}
4851

0 commit comments

Comments
 (0)