Minor adjustments for list view paste - thx OmrSi :)

Fix #3168
This commit is contained in:
Nikolaj Olsson 2018-11-12 05:38:21 +01:00
parent 2dee2d573c
commit eb515d1e32
2 changed files with 13 additions and 4 deletions

View File

@ -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)

View File

@ -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<int>();
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