From 94da9ca73a7b14ae481ea3ec12bdfce272659904 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Hannu=20Niemist=C3=B6?= Date: Thu, 5 Jan 2017 09:17:47 +0200 Subject: [PATCH] Don't add repeated commands to SCL Console command history refs #6939 [PRIVATE-12942] Change-Id: Ic432851620701a53227b0b76c2e2ac74160bfbbe --- .../scl/ui/console/AbstractCommandConsole.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/AbstractCommandConsole.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/AbstractCommandConsole.java index b4260b47b..bd011689f 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/AbstractCommandConsole.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/AbstractCommandConsole.java @@ -426,10 +426,12 @@ public abstract class AbstractCommandConsole extends Composite { return; // Add command to command history - commandHistory.add(command); - if(commandHistory.size() > COMMAND_HISTORY_SIZE*2) - commandHistory = new ArrayList( - commandHistory.subList(COMMAND_HISTORY_SIZE, COMMAND_HISTORY_SIZE*2)); + if(commandHistory.isEmpty() || !commandHistory.get(commandHistory.size()-1).equals(command)) { + commandHistory.add(command); + if(commandHistory.size() > COMMAND_HISTORY_SIZE*2) + commandHistory = new ArrayList( + commandHistory.subList(COMMAND_HISTORY_SIZE, COMMAND_HISTORY_SIZE*2)); + } commandHistoryPos = commandHistory.size(); // Print it into output area -- 2.47.1