From: SVN by r. <sv...@ca...> - 2008-03-03 10:47:21
|
Author: roy Date: 2008-03-03 11:42:27 +0100 (Mon, 03 Mar 2008) New Revision: 249 Modified: src/main/java/nl/improved/sqlclient/SQLShell.java Log: small cleanup of code made exit sqlshell the last keybinding in the help overview Modified: src/main/java/nl/improved/sqlclient/SQLShell.java =================================================================== --- src/main/java/nl/improved/sqlclient/SQLShell.java 2008-03-03 07:39:20 UTC (rev 248) +++ src/main/java/nl/improved/sqlclient/SQLShell.java 2008-03-03 10:42:27 UTC (rev 249) @@ -307,25 +307,25 @@ return "PageDown:\tMove forward in screen history"; } }); - actionKeys.put("", new KeyAction() { //Ctrl+D + actionKeys.put("", new KeyAction() { // ctrl+a public void execute() { - if (commandLines.getCommandString().length() == 0) { //Quit on empty commandline, ignore otherwise - executeCommand(new InputCommand("quit")); + output("Abort requested"); + if (commandThread.isAlive() && commandThread.getCommand().abort()) { + output("Abort done.."); } } public CharSequence getHelp() { - return "Control-D:\tExit sqlshell"; + return "Control-A:\tAbort current command (if it is supported by that command)"; } }); - actionKeys.put("", new KeyAction() { // ctrl+a + actionKeys.put("", new KeyAction() { //Ctrl+D public void execute() { - output("Abort requested"); - if (commandThread.isAlive() && commandThread.getCommand().abort()) { - output("Abort done.."); + if (commandLines.getCommandString().length() == 0) { //Quit on empty commandline, ignore otherwise + executeCommand(new InputCommand("quit")); } } public CharSequence getHelp() { - return "Control-A:\tAbort current command (if it is supported by that command)"; + return "Control-D:\tExit sqlshell"; } }); @@ -762,7 +762,7 @@ Logger.getLogger(SQLShell.class.getName()).log(Level.SEVERE, null, ex); } } - output(commandString+"\n"); + output(commandString); if (direct || !command.backgroundProcessSupported()) { output(command.execute(sqlCommand)); } else { @@ -1383,7 +1383,7 @@ FileInputStream fin = null; try { fin = new FileInputStream(toFileName(command.substring(1))); - output("Reading file: "+ toFileName(command.substring(1))+"\n"); + output("Reading file: "+ toFileName(command.substring(1))); BufferedReader reader = new BufferedReader(new InputStreamReader(fin)); StringBuilder cmd = new StringBuilder(); String line; @@ -1399,7 +1399,7 @@ // Exec cmd String commandString = cmd.toString(); currentCommand = createCommand(commandString); - output(commandString+"\n"); + output(commandString); output(currentCommand.execute(new InputCommand(commandString))); cmd=new StringBuilder(); } |