From: SVN by r. <sv...@ca...> - 2009-04-26 13:21:04
|
Author: roy Date: 2009-04-26 15:20:44 +0200 (Sun, 26 Apr 2009) New Revision: 408 Modified: src/main/java/nl/improved/sqlclient/AbstractSQLShellWindow.java Log: fix insert from past causing an indexoutofbounds in some cases Modified: src/main/java/nl/improved/sqlclient/AbstractSQLShellWindow.java =================================================================== --- src/main/java/nl/improved/sqlclient/AbstractSQLShellWindow.java 2009-04-26 12:33:02 UTC (rev 407) +++ src/main/java/nl/improved/sqlclient/AbstractSQLShellWindow.java 2009-04-26 13:20:44 UTC (rev 408) @@ -769,11 +769,11 @@ // check if the new line is becoming too long if (currentLine.length() > screen.MAX_LINE_LENGTH) { // TODO search for lastspace that is not between '' ?? - int lastSpace = SQLUtil.getLastBreakIndex(currentLine.toString());//currentLine.lastIndexOf(" "); - int lastChar = currentLine.charAt(lastSpace); + int lastSpace = SQLUtil.getLastBreakIndex(currentLine.toString().substring(0, screen.MAX_LINE_LENGTH-2));//currentLine.lastIndexOf(" "); if (lastSpace == -1) { lastSpace = currentLine.length(); } + int lastChar = currentLine.charAt(lastSpace); // check if there are enough 'next' lines // if not.. add one if (editableLines.size()-1 == cursorPosition.y) { |