Fix freeze in spell check change all - thx Edwin :)

This commit is contained in:
Nikolaj Olsson 2018-12-02 13:14:22 +01:00
parent 5db72ae5c5
commit 42d5320cd5

View File

@ -6657,7 +6657,13 @@ namespace Nikse.SubtitleEdit.Forms
int end = startIndex + oldWord.Length;
if (end <= p.Text.Length && end == p.Text.Length || ("«»“” ,.!?:;'()<>\"-—+/[]{}%&$£…\r\n؛،؟").Contains(p.Text[end]))
{
var lengthBefore = p.Text.Length;
p.Text = p.Text.Remove(startIndex, oldWord.Length).Insert(startIndex, changeWord);
var lengthAfter = p.Text.Length;
if (lengthAfter > lengthBefore)
{
startIndex += (lengthAfter - lengthBefore);
}
}
}
if (startIndex + 2 >= p.Text.Length)