mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-25 12:44:46 +01:00
Fix seeking, hope to improve racing
This commit is contained in:
parent
a8c1ba2432
commit
a669dec3cf
@ -6612,6 +6612,14 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
SubtitleListview1_SelectedIndexChanged(null, null);
|
||||
}
|
||||
|
||||
private void SelectListViewIndexAndEnsureVisible(Paragraph p)
|
||||
{
|
||||
SubtitleListview1.SelectedIndexChanged -= SubtitleListview1_SelectedIndexChanged;
|
||||
SubtitleListview1.SelectIndexAndEnsureVisible(p);
|
||||
SubtitleListview1.SelectedIndexChanged += SubtitleListview1_SelectedIndexChanged;
|
||||
SubtitleListview1_SelectedIndexChanged(null, null);
|
||||
}
|
||||
|
||||
private void FindPrevious()
|
||||
{
|
||||
if (_findHelper == null)
|
||||
@ -21996,10 +22004,14 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
controlSubtitle,
|
||||
(timeSeconds) =>
|
||||
{
|
||||
// Invoke to not interfere with any inserting
|
||||
BeginInvoke(new Action(() => {
|
||||
GoToTimeAndSelectPrecedingParagraph(timeSeconds);
|
||||
}));
|
||||
},
|
||||
(newParagraph) =>
|
||||
{
|
||||
// Synchronous, so it's (hopefully) done before the next seek
|
||||
InsertAndSelectParagraph(newParagraph);
|
||||
}
|
||||
);
|
||||
@ -22019,7 +22031,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
// Select correct paragraph
|
||||
for (int i = 0; i < _subtitle.Paragraphs.Count; i++)
|
||||
{
|
||||
if (timeSeconds > _subtitle.Paragraphs[i].EndTime.TotalSeconds)
|
||||
if (_subtitle.Paragraphs[i].EndTime.TotalSeconds > timeSeconds)
|
||||
{
|
||||
index = i - 1;
|
||||
SelectListViewIndexAndEnsureVisible(index);
|
||||
@ -22075,7 +22087,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
// Select it if needed
|
||||
if (selectInsertedParagraph)
|
||||
{
|
||||
SubtitleListview1.SelectIndexAndEnsureVisible(paragraph);
|
||||
SelectListViewIndexAndEnsureVisible(paragraph);
|
||||
}
|
||||
|
||||
UpdateSourceView();
|
||||
|
Loading…
Reference in New Issue
Block a user