Debugger search buttons now support looping over.

This commit is contained in:
ruri
2019-05-03 18:35:09 +02:00
parent d74e1077ff
commit d04c61ba50
+25 -5
View File
@@ -587,10 +587,20 @@ namespace OpenBullet
private void previousMatchButton_MouseDown(object sender, MouseButtonEventArgs e)
{
if (vm.CurrentSearchMatch == 1 || vm.TotalSearchMatches == 0)
if (vm.TotalSearchMatches == 0) // If no matches, do nothing
{
return;
vm.CurrentSearchMatch--;
}
if (vm.CurrentSearchMatch == 1) // If we need to loop around
{
vm.CurrentSearchMatch = vm.Indexes.Count;
}
else
{
vm.CurrentSearchMatch--;
}
logRTB.DeselectAll();
logRTB.Select(vm.Indexes[vm.CurrentSearchMatch - 1], 0);
logRTB.ScrollToCaret();
@@ -598,10 +608,20 @@ namespace OpenBullet
private void nextMatchButton_MouseDown(object sender, MouseButtonEventArgs e)
{
if (vm.CurrentSearchMatch == vm.Indexes.Count || vm.TotalSearchMatches == 0)
if (vm.TotalSearchMatches == 0) // If no matches, do nothing
{
return;
}
if (vm.CurrentSearchMatch == vm.Indexes.Count) // If we need to loop around
{
vm.CurrentSearchMatch = 1;
}
else
{
vm.CurrentSearchMatch++;
}
vm.CurrentSearchMatch++;
logRTB.DeselectAll();
logRTB.Select(vm.Indexes[vm.CurrentSearchMatch - 1], 0);
logRTB.ScrollToCaret();