Fix #809, properly close all SRT overrides during export and ensure overrides in recombined lines do not affect each other (per the example I gave in the report.)

Originally committed to SVN as r2934.
This commit is contained in:
Niels Martin Hansen 2009-05-15 01:34:00 +00:00
parent 44e17e9e11
commit 988df0ab81
2 changed files with 17 additions and 1 deletions

View File

@ -671,6 +671,16 @@ void AssDialogue::ConvertTagsToSRT () {
}
}
// Ensure all tags are closed
if (isBold)
final += _T("</b>");
if (isItalic)
final += _T("</i>");
if (isUnder)
final += _T("</u>");
if (isStrike)
final += _T("</s>");
Text = final;
UpdateData();
ClearBlocks();

View File

@ -184,9 +184,15 @@ void SRTSubtitleFormat::WriteFile(wxString _filename,wxString encoding) {
CreateCopy();
SortLines();
StripComments();
// Tags must be converted in two passes
// First ASS style overrides are converted to SRT but linebreaks are kept
ConvertTags(2,_T("\\N"));
// Then we can recombine overlaps, this requires ASS style linebreaks
RecombineOverlaps();
MergeIdentical();
ConvertTags(2,_T("\r\n"));
// And finally convert linebreaks
ConvertTags(0,_T("\r\n"));
// Otherwise unclosed overrides might affect lines they shouldn't, see bug #809 for example
// Write lines
int i=1;