Try to fix Replace issue - thx loyaldragon :)

This commit is contained in:
Nikolaj Olsson 2019-11-04 19:21:43 +01:00
parent 722a984c6f
commit 07f0c9cb11

View File

@ -5467,6 +5467,7 @@ namespace Nikse.SubtitleEdit.Forms
{ {
tb.SelectedText = _findHelper.ReplaceText; tb.SelectedText = _findHelper.ReplaceText;
msg = _language.OneReplacementMade + " "; msg = _language.OneReplacementMade + " ";
_findHelper.SelectedPosition += _findHelper.ReplaceText.Length;
} }
if (_findHelper.FindNext(_subtitle, _subtitleAlternate, _findHelper.SelectedIndex, _findHelper.SelectedPosition, Configuration.Settings.General.AllowEditOfOriginalSubtitle)) if (_findHelper.FindNext(_subtitle, _subtitleAlternate, _findHelper.SelectedIndex, _findHelper.SelectedPosition, Configuration.Settings.General.AllowEditOfOriginalSubtitle))
@ -5513,18 +5514,25 @@ namespace Nikse.SubtitleEdit.Forms
if (replaceDialog != null && !replaceDialog.IsDisposed) if (replaceDialog != null && !replaceDialog.IsDisposed)
{ {
replaceDialog.Dispose(); replaceDialog.Dispose();
replaceDialog = null;
} }
_findHelper.InProgress = false; _findHelper.InProgress = false;
return; return;
} }
} }
else
{
if (replaceDialog != null && !replaceDialog.IsDisposed)
{
replaceDialog.Dispose();
}
_findHelper.InProgress = false;
return;
}
} }
Replace(replaceDialog); Replace(replaceDialog);
if (replaceDialog != null && !replaceDialog.IsDisposed) if (replaceDialog != null && !replaceDialog.IsDisposed)
{ {
replaceDialog.Dispose(); replaceDialog.Dispose();
replaceDialog = null;
} }
_findHelper.InProgress = false; _findHelper.InProgress = false;
return; return;