From b3489ea40ed7f94ce4b88a0aff6c1d4af43842f4 Mon Sep 17 00:00:00 2001 From: ivandrofly Date: Sun, 23 Aug 2015 21:02:29 +0100 Subject: [PATCH 1/3] [internal] - enforce numbering from 1 --- src/Forms/MergeShortLines.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Forms/MergeShortLines.cs b/src/Forms/MergeShortLines.cs index 2635d5c85..9be1d70a7 100644 --- a/src/Forms/MergeShortLines.cs +++ b/src/Forms/MergeShortLines.cs @@ -36,7 +36,7 @@ namespace Nikse.SubtitleEdit.Forms public void Initialize(Subtitle subtitle) { if (subtitle.Paragraphs.Count > 0) - subtitle.Renumber(subtitle.Paragraphs[0].Number); + subtitle.Renumber(); Text = Configuration.Settings.Language.MergedShortLines.Title; labelMaxCharacters.Text = Configuration.Settings.Language.MergedShortLines.MaximumCharacters; From 1c9b09ceb0e149ed5cca66b5e89c97bae218abd0 Mon Sep 17 00:00:00 2001 From: ivandrofly Date: Sun, 23 Aug 2015 21:04:18 +0100 Subject: [PATCH 2/3] [internal] - minor refactor add item to listview --- src/Forms/MergeShortLines.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Forms/MergeShortLines.cs b/src/Forms/MergeShortLines.cs index 9be1d70a7..4e034be20 100644 --- a/src/Forms/MergeShortLines.cs +++ b/src/Forms/MergeShortLines.cs @@ -61,12 +61,8 @@ namespace Nikse.SubtitleEdit.Forms private void AddToListView(Paragraph p, string lineNumbers, string newText) { var item = new ListViewItem(string.Empty) { Tag = p, Checked = true }; - - var subItem = new ListViewItem.ListViewSubItem(item, lineNumbers.TrimEnd(',')); - item.SubItems.Add(subItem); - subItem = new ListViewItem.ListViewSubItem(item, newText.Replace(Environment.NewLine, Configuration.Settings.General.ListViewLineSeparatorString)); - item.SubItems.Add(subItem); - + item.SubItems.Add(lineNumbers.TrimEnd(',')); + item.SubItems.Add(newText.Replace(Environment.NewLine, Configuration.Settings.General.ListViewLineSeparatorString)); listViewFixes.Items.Add(item); } From 42cf4f63b8998f184d9b7ff4cb25ce13915d8423 Mon Sep 17 00:00:00 2001 From: ivandrofly Date: Sun, 23 Aug 2015 21:14:51 +0100 Subject: [PATCH 3/3] [Bugfix] - Fix bug QualifiesForMerge will return incorrect return if nextText Contains html/Ssa tags --- src/Forms/MergeShortLines.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Forms/MergeShortLines.cs b/src/Forms/MergeShortLines.cs index 4e034be20..913858887 100644 --- a/src/Forms/MergeShortLines.cs +++ b/src/Forms/MergeShortLines.cs @@ -223,9 +223,9 @@ namespace Nikse.SubtitleEdit.Forms { if (p != null && p.Text != null && next != null && next.Text != null) { - string s = HtmlUtil.RemoveHtmlTags(p.Text.Trim()); - - if (p.Text.Length + next.Text.Length < maximumTotalLength && next.StartTime.TotalMilliseconds - p.EndTime.TotalMilliseconds < maximumMillisecondsBetweenLines) + var s = HtmlUtil.RemoveHtmlTags(p.Text.Trim(), true); + var nextText = HtmlUtil.RemoveHtmlTags(next.Text.Trim(), true); + if (s.Length + nextText.Length < maximumTotalLength && next.StartTime.TotalMilliseconds - p.EndTime.TotalMilliseconds < maximumMillisecondsBetweenLines) { if (string.IsNullOrEmpty(s)) return true; @@ -234,8 +234,7 @@ namespace Nikse.SubtitleEdit.Forms if (!checkBoxOnlyContinuationLines.Checked) return true; - if (isLineContinuation) - return true; + return isLineContinuation; } } return false;