From 424e7ebb1beaf65888251ed3d4d17cca6b39ca24 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 9 Apr 2013 07:01:05 +0200 Subject: [PATCH] Make an empty line repeat the last command. --- src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java b/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java index 8b35858..9c8c86c 100644 --- a/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java +++ b/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java @@ -61,9 +61,13 @@ public class CommandReader extends AbstractExecutionThreadService { @Override protected void run() throws Exception { + String lastLine = ""; String line; final List lastResult = Lists.newArrayList(); while ((line = reader.readLine()) != null) { + if (line.equals("")) { + line = lastLine; + } String[] words = line.split(" +"); if (words[0].equalsIgnoreCase("search")) { lastResult.clear(); @@ -91,6 +95,8 @@ public class CommandReader extends AbstractExecutionThreadService { } System.out.println("End of Search."); } + + lastLine = line; } } -- 2.7.4