Make an empty line repeat the last command.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 9 Apr 2013 05:01:05 +0000 (07:01 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 9 Apr 2013 05:01:05 +0000 (07:01 +0200)
src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java

index 8b35858..9c8c86c 100644 (file)
@@ -61,9 +61,13 @@ public class CommandReader extends AbstractExecutionThreadService {
 
        @Override
        protected void run() throws Exception {
+               String lastLine = "";
                String line;
                final List<Result> 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;
                }
        }