edu.iu.cnets.klatsch.misc
Class LineEditor

java.lang.Object
  extended by edu.iu.cnets.klatsch.misc.LineEditor

public class LineEditor
extends java.lang.Object

This class takes care of line editing in the console version of the interpreter. Note that it's not capable of making standard input unbuffered on its own -- that's why the klatsch wrapper calls 'stty -icanon' before firing up Java.


Field Summary
(package private)  History history
          the history associated with the editor
(package private)  java.io.Reader in
          our source of data
(package private)  int lineNumber
          our current line number of input
(package private)  boolean noEscape
          true to suppress VT100 escape codes
(package private)  java.lang.String prompt
          the prompt to use for the hapless user
 
Constructor Summary
LineEditor(java.io.Reader in, java.lang.String prompt, boolean noEscape)
          Initialize with a source of character data, a prompt, and the noEscape flag.
 
Method Summary
 java.lang.String readLine()
          Reads another line of input from our data source.
(package private)  void redraw(java.lang.StringBuffer buffer, int point)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

in

java.io.Reader in
our source of data


prompt

java.lang.String prompt
the prompt to use for the hapless user


noEscape

boolean noEscape
true to suppress VT100 escape codes


history

History history
the history associated with the editor


lineNumber

int lineNumber
our current line number of input

Constructor Detail

LineEditor

public LineEditor(java.io.Reader in,
                  java.lang.String prompt,
                  boolean noEscape)
Initialize with a source of character data, a prompt, and the noEscape flag.

Parameters:
in - the character-based data source
prompt - the prompt
noEscape - suppress VT100 escape codes?
Method Detail

readLine

public java.lang.String readLine()
                          throws java.io.IOException
Reads another line of input from our data source. The returned string does not have the trailing newline attached.

Returns:
the next line of input
Throws:
java.io.IOException - if a full line could not be read

redraw

void redraw(java.lang.StringBuffer buffer,
            int point)