Skip to content

Commit

Permalink
fix: 剧本翻译允许输入三行
Browse files Browse the repository at this point in the history
  • Loading branch information
Icexbb committed Dec 16, 2024
1 parent ca06606 commit 3dfdb99
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private void TextBox_PreviewKeyDown(object sender, KeyEventArgs e)
if (sender is not TextBox textBox) return;
if (e.Key != Key.Enter) return;
var lineCount = textBox.LineCount;
if (lineCount >= 2) e.Handled = true; // 阻止回车键输入新行
if (lineCount >= 3) e.Handled = true; // 阻止回车键输入新行
}

private void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
Expand All @@ -41,6 +41,6 @@ private void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
var newText = textBox.Text.Insert(textBox.CaretIndex, e.Text);
var newLineCount = newText.Split('\n').Length;

if (newLineCount > 2) e.Handled = true; // 阻止输入导致超过三行
if (newLineCount > 3) e.Handled = true; // 阻止输入导致超过三行
}
}

0 comments on commit 3dfdb99

Please sign in to comment.