From: SVN by r. <sv...@ca...> - 2008-10-14 19:11:55
|
Author: roy Date: 2008-10-14 21:11:45 +0200 (Tue, 14 Oct 2008) New Revision: 321 Modified: src/main/java/nl/improved/sqlclient/charva/CharvaSQLShellWindow.java Log: added logfile for charva (tmpdir/charva*.out) This file will be removed on exit fixed cursor position when screenbuffer > screensize Modified: src/main/java/nl/improved/sqlclient/charva/CharvaSQLShellWindow.java =================================================================== --- src/main/java/nl/improved/sqlclient/charva/CharvaSQLShellWindow.java 2008-10-14 18:57:36 UTC (rev 320) +++ src/main/java/nl/improved/sqlclient/charva/CharvaSQLShellWindow.java 2008-10-14 19:11:45 UTC (rev 321) @@ -11,10 +11,16 @@ import charva.awt.event.KeyEvent; import charvax.swing.JMenuItem; import charvax.swing.JPopupMenu; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import java.util.Vector; +import java.util.logging.Level; +import java.util.logging.Logger; import nl.improved.sqlclient.AbstractSQLShellWindow; import nl.improved.sqlclient.InputKey; import nl.improved.sqlclient.Point; @@ -27,6 +33,7 @@ */ class CharvaSQLShellWindow extends AbstractSQLShellWindow { private SQLShellComponent textComponent; + private OutputStream debugOut; /** * Constructor. @@ -34,6 +41,13 @@ */ public CharvaSQLShellWindow(SQLShellComponent textComponent) { this.textComponent = textComponent; + try { + File tmpFile = File.createTempFile("charva", ".out"); + tmpFile.deleteOnExit(); + debugOut = new FileOutputStream(tmpFile); + } catch (IOException ex) { + Logger.getLogger(CharvaSQLShellWindow.class.getName()).log(Level.SEVERE, null, ex); + } } @Override @@ -80,8 +94,8 @@ totalLineCount++; } } - if (totalLineCount > getScreenHeight()-1) { - totalLineCount = getScreenHeight()-1; + if (totalLineCount > getScreenHeight()-commandLines.size()) { + totalLineCount = getScreenHeight()-commandLines.size(); } String trimmed = trim(newText, screen.getPageUpCount()); if (trimmed.startsWith(textComponent.getText())) { @@ -114,7 +128,13 @@ @Override public void debug(String debug) { - + if (debugOut != null) { + try { + debugOut.write((debug + "\n").getBytes()); + } catch (IOException ex) { + Logger.getLogger(CharvaSQLShellWindow.class.getName()).log(Level.SEVERE, null, ex); + } + } } @Override |