From eb515d1e32a90a3fdf5469b7025922fef5b2315a Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Mon, 12 Nov 2018 05:38:21 +0100 Subject: [PATCH] Minor adjustments for list view paste - thx OmrSi :) Fix #3168 --- Changelog.txt | 4 +++- src/Forms/Main.cs | 13 ++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index ee123a428..d2500438c 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -16,8 +16,9 @@ * Make custom "Choose font" dialog - thx OmrSi * Update Bing translator from V2 to V3 API * Faster Tesseract OCR if CPU has many cores - * Try using word lists for uppercase i inside words - thx TeDDy + * Try using word lists for uppercase "i" inside words - thx TeDDy * Improve unknown json importer - thx Thamy + * Improve paste in list view - thx OmrSi/darnn * FIXED: * Go back to Tesseract 3.02 (T4 Beta3 available as in-program download) * Fix Bing translator sign-up url - thx sopor @@ -37,6 +38,7 @@ * Add custom fade up/down for DCinema smpte - thx felagund * Fix reading last line with zero duration - thx darnn * Fix for column paste - thx OmrSi + * Fix syntax coloring in "Fix common errors" - thx OmrSi 3.5.7 (9th August 2018) diff --git a/src/Forms/Main.cs b/src/Forms/Main.cs index 1269b6f91..4a5de0412 100644 --- a/src/Forms/Main.cs +++ b/src/Forms/Main.cs @@ -13978,18 +13978,25 @@ namespace Nikse.SubtitleEdit.Forms double addMs = 0; if (lastParagraph.EndTime.TotalMilliseconds > tmp.Paragraphs[0].StartTime.TotalMilliseconds) { // add time to pasted subtitles to prevent overlap, but only if necessary - addMs = lastParagraph.EndTime.TotalMilliseconds - tmp.Paragraphs[0].StartTime.TotalMilliseconds + 1000; + addMs = lastParagraph.EndTime.TotalMilliseconds - tmp.Paragraphs[0].StartTime.TotalMilliseconds + Configuration.Settings.General.MinimumMillisecondsBetweenLines; } - SaveSubtitleListviewIndices(); + var selectIndices = new List(); for (int i = 0; i < tmp.Paragraphs.Count; i++) { var p = tmp.Paragraphs[i]; p.StartTime.TotalMilliseconds += addMs; p.EndTime.TotalMilliseconds += addMs; _subtitle.Paragraphs.Insert(firstIndex + i + 1, p); + selectIndices.Insert(0 ,firstIndex + i +1); } SubtitleListview1.Fill(_subtitle, _subtitleAlternate); - RestoreSubtitleListviewIndices(); + SubtitleListview1.BeginUpdate(); + SubtitleListview1.SelectIndexAndEnsureVisible(firstIndex + 1, true); + foreach (var selectIndex in selectIndices) + { + SubtitleListview1.Items[selectIndex].Selected = true; + } + SubtitleListview1.EndUpdate(); } else if (SubtitleListview1.Items.Count == 0 && tmp.Paragraphs.Count > 0) { // insert into empty subtitle