From: SVN by r. <sv...@ca...> - 2008-07-16 21:03:15
|
Author: roy Date: 2008-07-16 23:03:05 +0200 (Wed, 16 Jul 2008) New Revision: 264 Modified: src/main/java/nl/improved/sqlclient/SQLShell.java Log: rollback quit improvements to ctrl+w Modified: src/main/java/nl/improved/sqlclient/SQLShell.java =================================================================== --- src/main/java/nl/improved/sqlclient/SQLShell.java 2008-07-16 20:47:38 UTC (rev 263) +++ src/main/java/nl/improved/sqlclient/SQLShell.java 2008-07-16 21:03:05 UTC (rev 264) @@ -225,11 +225,7 @@ public void execute() { if (cursorPosition.x == 0) { if (cursorPosition.y > 0) { - StringBuilder line = getEditableCommand().getEditableLines().remove(cursorPosition.y); - cursorPosition.y--; - StringBuilder lineBuffer = commandLines.getEditableLines().get(cursorPosition.y); - cursorPosition.x = lineBuffer.length(); - lineBuffer.append(line); + joinLine(); } } else { StringBuilder tmp = getEditableCommand().getEditableLines().get(cursorPosition.y); @@ -256,7 +252,13 @@ } }); actionKeys.put("", new KeyAction() { - public void execute() { + public void execute() { // ctrl+w + if (cursorPosition.x == 0) { + if (cursorPosition.y > 0) { + joinLine(); + } + return; + } StringBuilder lineBuffer = commandLines.getEditableLines().get(cursorPosition.y); int previousBreak = SQLUtil.getLastBreakIndex(lineBuffer.substring(0, cursorPosition.x-1)); if (lineBuffer.charAt(previousBreak) == ' ' || lineBuffer.charAt(previousBreak) == '\t') { @@ -580,7 +582,7 @@ e.printStackTrace(new PrintWriter(sw)); sw.flush(); lastExceptionDetails = sw.toString(); - output(sw.toString()); + //output(sw.toString()); } /** @@ -1166,9 +1168,7 @@ } @Override public CharSequence execute(SQLCommand command) { - //close(); hide(); - Window.closeAllWindows(); return "Application terminated."; } @Override @@ -1607,6 +1607,13 @@ } + private void joinLine() { + StringBuilder line = getEditableCommand().getEditableLines().remove(cursorPosition.y); + cursorPosition.y--; + StringBuilder lineBuffer = commandLines.getEditableLines().get(cursorPosition.y); + cursorPosition.x = lineBuffer.length(); + lineBuffer.append(line); + } private interface KeyAction { void execute(); CharSequence getHelp(); @@ -1614,9 +1621,7 @@ public static void main(String[] args) { SQLShell shell = new SQLShell(); - shell.setVisible(false); - shell.setVisible(true); - //shell.show(); + shell.show(); //Interpret first argument as a connect argument if (args.length > 0) { |