From: David ‘Bombe’ Roden Date: Tue, 9 Apr 2013 05:01:05 +0000 (+0200) Subject: Make an empty line repeat the last command. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=424e7ebb1beaf65888251ed3d4d17cca6b39ca24;p=xudocci.git Make an empty line repeat the last command. --- 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; } }