From 94d12b0c5416325534d5c7b47090f62f88e25085 Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Sat, 21 Mar 2020 10:09:45 +0100 Subject: [PATCH] Fix "Join" with append issues - thx Henrique :) Do not auto-sort when adding files in append mode --- src/Forms/JoinSubtitles.cs | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/Forms/JoinSubtitles.cs b/src/Forms/JoinSubtitles.cs index 7ea960318..b582e1c12 100644 --- a/src/Forms/JoinSubtitles.cs +++ b/src/Forms/JoinSubtitles.cs @@ -176,21 +176,25 @@ namespace Nikse.SubtitleEdit.Forms } JoinedFormat = lastFormat; - for (int outer = 0; outer < subtitles.Count; outer++) - { - for (int inner = 1; inner < subtitles.Count; inner++) - { - var a = subtitles[inner - 1]; - var b = subtitles[inner]; - if (a.Paragraphs.Count > 0 && b.Paragraphs.Count > 0 && a.Paragraphs[0].StartTime.TotalMilliseconds > b.Paragraphs[0].StartTime.TotalMilliseconds) - { - string t1 = _fileNamesToJoin[inner - 1]; - _fileNamesToJoin[inner - 1] = _fileNamesToJoin[inner]; - _fileNamesToJoin[inner] = t1; - var t2 = subtitles[inner - 1]; - subtitles[inner - 1] = subtitles[inner]; - subtitles[inner] = t2; + if (!radioButtonJoinAddTime.Checked) + { + for (int outer = 0; outer < subtitles.Count; outer++) + { + for (int inner = 1; inner < subtitles.Count; inner++) + { + var a = subtitles[inner - 1]; + var b = subtitles[inner]; + if (a.Paragraphs.Count > 0 && b.Paragraphs.Count > 0 && a.Paragraphs[0].StartTime.TotalMilliseconds > b.Paragraphs[0].StartTime.TotalMilliseconds) + { + string t1 = _fileNamesToJoin[inner - 1]; + _fileNamesToJoin[inner - 1] = _fileNamesToJoin[inner]; + _fileNamesToJoin[inner] = t1; + + var t2 = subtitles[inner - 1]; + subtitles[inner - 1] = subtitles[inner]; + subtitles[inner] = t2; + } } } } @@ -338,6 +342,7 @@ namespace Nikse.SubtitleEdit.Forms { numericUpDownAddMs.Enabled = radioButtonJoinAddTime.Checked; labelAddTime.Enabled = radioButtonJoinAddTime.Checked; + SortAndLoad(); } } }