Merge pull request #8993 from ivandrofly/fix/advanced-text-box

Fixes off-by-one error
This commit is contained in:
Nikolaj Olsson 2024-11-14 18:02:04 +01:00 committed by GitHub
commit 85b8abc764
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -107,7 +107,7 @@ namespace Nikse.SubtitleEdit.Controls
{
args.SuppressKeyPress = true;
}
else if (args.KeyData == Keys.Home && (SelectionStart == 0 || SelectionStart > 0 && Text[SelectionStart - 1] == '\n'))
else if (args.KeyData == Keys.Home && SelectionStart == 0 || (SelectionStart > 0 && Text[SelectionStart - 1] == '\n'))
{
args.SuppressKeyPress = true;
}
@ -115,7 +115,7 @@ namespace Nikse.SubtitleEdit.Controls
{
args.SuppressKeyPress = true;
}
else if (args.KeyData == Keys.End && (SelectionStart >= Text.Length || SelectionStart + 1 < Text.Length && Text[SelectionStart + 1] == '\n'))
else if (args.KeyData == Keys.End && SelectionStart >= Text.Length || (SelectionStart + 1 < Text.Length && Text[SelectionStart + 1] == '\n'))
{
args.SuppressKeyPress = true;
}