Keep bookmarks after edit in source view - thx Ingo :)

This commit is contained in:
Nikolaj Olsson 2020-07-12 10:15:18 +02:00
parent 9541f2f9ef
commit 9c7858ec64
2 changed files with 16 additions and 1 deletions

View File

@ -3,6 +3,7 @@
3.5.17 (xth September 2020) BETA
* NEW:
* Add new subtitle format - thx Holmgeir
* Add shortcuts for Tools menu items Split/Append/Join - thx z3us
* IMPROVED:
* Update Bulgarian translation - thx KalinM
* Update Hungarian translation - thx Zityi
@ -18,6 +19,7 @@
* Fix "Import plain text" for small resolutions - thx doquan0
* Fix syntax coloring after replace - thx OmrSi
* Fix minor label issue at startup - thx Bill
* Keep bookmarks after edit in source view - thx Ingo
3.5.16 (16th June 2020)

View File

@ -5952,7 +5952,8 @@ namespace Nikse.SubtitleEdit.Forms
SaveSubtitleListviewIndices();
if (!string.IsNullOrWhiteSpace(textBoxSource.Text))
{
SubtitleFormat format = GetCurrentSubtitleFormat();
var oldSubtitle = new Subtitle(_subtitle);
var format = GetCurrentSubtitleFormat();
var list = textBoxSource.Lines.ToList();
format = new Subtitle().ReloadLoadSubtitle(list, null, format);
if (format == null)
@ -5977,6 +5978,18 @@ namespace Nikse.SubtitleEdit.Forms
index++;
}
for (int i = 0; i < oldSubtitle.Paragraphs.Count; i++)
{
if (oldSubtitle.Paragraphs[i].Bookmark != null)
{
var newParagraph = _subtitle.GetFirstAlike(oldSubtitle.Paragraphs[i]);
if (newParagraph != null)
{
newParagraph.Bookmark = oldSubtitle.Paragraphs[i].Bookmark;
}
}
}
if (Configuration.Settings.General.CurrentVideoOffsetInMs != 0)
{
_subtitle.AddTimeToAllParagraphs(TimeSpan.FromMilliseconds(-Configuration.Settings.General.CurrentVideoOffsetInMs));