Toggle sort direction in new "Multiple replacde" rules sort

This commit is contained in:
Nikolaj Olsson 2024-02-17 16:56:02 +01:00
parent cc18f0a0fa
commit 071556c1ca
2 changed files with 10 additions and 1 deletions

View File

@ -5,6 +5,7 @@
* Add Whisper CPP model "small.en-q5_1.bin"
* Add shortcut for "Translate selected lines"
* Add Gemini translate (beta, not all regions) - thx darnn
* Add sorting of rules in "Multiple replace" - thx caioeverest
* IMPROVED:
* Update Korean translation - thx domddol
* Update Portuguese translation - thx hugok79

View File

@ -31,6 +31,7 @@ namespace Nikse.SubtitleEdit.Forms
private Subtitle _subtitle;
private IReloadSubtitle _reloadSubtitle;
private Subtitle _original;
private bool _sortAscending;
public Subtitle FixedSubtitle { get; private set; }
public int FixCount { get; private set; }
public List<int> DeleteIndices { get; }
@ -1536,7 +1537,9 @@ namespace Nikse.SubtitleEdit.Forms
private void SortItems(int column)
{
var items = new List<MultipleSearchAndReplaceSetting>();
List<MultipleSearchAndReplaceSetting> items;
_sortAscending = !_sortAscending;
switch (column)
{
@ -1548,6 +1551,11 @@ namespace Nikse.SubtitleEdit.Forms
default: items = _currentGroup.Rules.OrderBy(i => i.FindWhat).ToList(); break;
}
if (!_sortAscending)
{
items.Reverse();
}
_currentGroup.Rules.Clear();
_currentGroup.Rules.AddRange(items);
UpdateViewFromModel(Configuration.Settings.MultipleSearchAndReplaceGroups, _currentGroup);