From 2b23d996078b0ef1349a6f98cf8ab9169c3d566f Mon Sep 17 00:00:00 2001 From: niksedk Date: Mon, 22 Nov 2021 16:07:24 +0100 Subject: [PATCH] Change search a batch convert a tiny bit --- src/ui/Forms/BatchConvert.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/ui/Forms/BatchConvert.cs b/src/ui/Forms/BatchConvert.cs index 380308de0..b893194e6 100644 --- a/src/ui/Forms/BatchConvert.cs +++ b/src/ui/Forms/BatchConvert.cs @@ -633,6 +633,7 @@ namespace Nikse.SubtitleEdit.Forms { return; } + try { foreach (ListViewItem lvi in listViewInputFiles.Items) @@ -816,6 +817,7 @@ namespace Nikse.SubtitleEdit.Forms } UpdateNumberOfFiles(); + _listViewItemBeforeSearch = null; } private static string MakeMkvTrackInfoString(MatroskaTrackInfo track) @@ -2446,6 +2448,7 @@ namespace Nikse.SubtitleEdit.Forms listViewInputFiles.Items.Clear(); UpdateNumberOfFiles(); UpdateTransportStreamSettings(); + _listViewItemBeforeSearch = null; } private void RemoveSelectedFiles() @@ -2481,6 +2484,7 @@ namespace Nikse.SubtitleEdit.Forms UpdateNumberOfFiles(); UpdateTransportStreamSettings(); + _listViewItemBeforeSearch = null; } private void RemoveToolStripMenuItemClick(object sender, EventArgs e) @@ -2831,6 +2835,7 @@ namespace Nikse.SubtitleEdit.Forms textBoxFilter.Visible = comboBoxFilter.SelectedIndex == 3 || comboBoxFilter.SelectedIndex == 4 || comboBoxFilter.SelectedIndex == 5; } + private List _listViewItemBeforeSearch; private void textBoxFilter_TextChanged(object sender, EventArgs e) { if (listViewInputFiles.Items.Count == 0) @@ -2840,15 +2845,20 @@ namespace Nikse.SubtitleEdit.Forms if (comboBoxFilter.SelectedIndex == 5) { - var listViewItems = new List(); - foreach (ListViewItem item in listViewInputFiles.Items) + if (_listViewItemBeforeSearch == null) { - listViewItems.Add(item); + var listViewItems = new List(); + foreach (ListViewItem item in listViewInputFiles.Items) + { + listViewItems.Add(item); + } + + _listViewItemBeforeSearch = listViewItems; } listViewInputFiles.BeginUpdate(); listViewInputFiles.Items.Clear(); - listViewInputFiles.Items.AddRange(listViewItems.FindAll(item => item.SubItems[2].Text.Contains(textBoxFilter.Text, StringComparison.OrdinalIgnoreCase)).ToArray()); + listViewInputFiles.Items.AddRange(_listViewItemBeforeSearch.FindAll(item => item.SubItems[2].Text.Contains(textBoxFilter.Text, StringComparison.OrdinalIgnoreCase)).ToArray()); listViewInputFiles.EndUpdate(); UpdateNumberOfFiles(); }