Don't add the exact same line twice

issue: MatterHackers/MatterControl#4880
terminal selection issues
This commit is contained in:
Lars Brubaker 2020-10-19 16:24:58 -07:00
parent 9dfbd0ee37
commit 6f77515fc6
3 changed files with 10 additions and 3 deletions

View file

@ -30,7 +30,6 @@ either expressed or implied, of the FreeBSD Project.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.PrinterCommunication;

View file

@ -30,6 +30,7 @@ either expressed or implied, of the FreeBSD Project.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using MatterControl.Printing;
using MatterHackers.Agg;
using MatterHackers.Agg.Platform;
@ -200,6 +201,7 @@ namespace MatterHackers.MatterControl
{
commandHistoryIndex = 0;
}
changeToHistory = true;
}
else if (keyEvent.KeyCode == Keys.Down)
@ -393,8 +395,14 @@ namespace MatterHackers.MatterControl
{
textToSend = textToSend.ToUpper();
}
commandHistory.Add(textToSend);
if (commandHistory.LastOrDefault() != textToSend)
{
commandHistory.Add(textToSend);
}
commandHistoryIndex = commandHistory.Count;
printer.Connection.QueueLine(textToSend);
manualCommandTextEdit.Text = "";
}