mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-21 18:52:36 +01:00
Merge pull request #8921 from Flitskikker/feature/btc-bugfix-20241018
Small "Beautify time codes" improvement
This commit is contained in:
commit
a2a226a2b5
@ -111,7 +111,7 @@ namespace Nikse.SubtitleEdit.Core.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private bool FixConnectedSubtitles(Paragraph leftParagraph = null, Paragraph rightParagraph = null)
|
||||
private bool FixConnectedSubtitles(Paragraph leftParagraph = null, Paragraph rightParagraph = null, bool checkConnected = true)
|
||||
{
|
||||
if (leftParagraph == null || rightParagraph == null)
|
||||
{
|
||||
@ -140,7 +140,7 @@ namespace Nikse.SubtitleEdit.Core.Forms
|
||||
|
||||
var subtitlesAreConnected = distance < Configuration.Settings.BeautifyTimeCodes.Profile.ConnectedSubtitlesTreatConnected;
|
||||
|
||||
if (subtitlesAreConnected)
|
||||
if (subtitlesAreConnected || !checkConnected)
|
||||
{
|
||||
var newLeftOutCueFrame = MillisecondsToFrames(leftParagraph.EndTime.TotalMilliseconds);
|
||||
var newRightInCueFrame = MillisecondsToFrames(rightParagraph.StartTime.TotalMilliseconds);
|
||||
@ -539,6 +539,17 @@ namespace Nikse.SubtitleEdit.Core.Forms
|
||||
bestRightInCueFrame = newRightInCueFrame;
|
||||
}
|
||||
|
||||
// Re-check if, with the new cues, the subtitles are actually connected
|
||||
var newDistance = FramesToMilliseconds(bestRightInCueFrame) - FramesToMilliseconds(bestLeftOutCueFrame);
|
||||
if (newDistance < Configuration.Settings.BeautifyTimeCodes.Profile.ConnectedSubtitlesTreatConnected)
|
||||
{
|
||||
// Yes, so handle using the designated function, ignoring its check connected check
|
||||
// (because otherwise it would have handled it before going into the FixChainableSubtitles function)
|
||||
FixConnectedSubtitles(leftParagraph, rightParagraph, checkConnected: false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check cases
|
||||
var isLeftOutCueOnShotChange = IsCueOnShotChange(bestLeftOutCueFrame, false);
|
||||
var isRightInCueOnShotChange = IsCueOnShotChange(bestRightInCueFrame, true);
|
||||
|
Loading…
Reference in New Issue
Block a user