All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.cometway.jerminal.EmacsKeyListener

com.cometway.jerminal.EmacsKeyListener

public class EmacsKeyListener
implements JerminalKeyListener
This implementation of JerminalKeyListener interprets the keyboard input using the Emacs keyset. Editting keys behave like emacs editing keys.


Variable Index

 o alt
 o buffer
This is the input buffer.
 o ctrl
 o historyIndex
 o index
This is the cursor index of the input buffer.
 o insert
This flag determines whether input should be inserted at the cursor or overwritten
 o interpret
This flag determines whether this key listener should interpret the input as Emacs keys
 o killBuffer
This buffer is the copy/paste buffer
 o parent
This keylistener's parent JerminalWindow, keyboard input is read from here
 o shift
 o tmpHistory

Constructor Index

 o EmacsKeyListener(JerminalWindow)
This constructor assigns the parent to the JerminalWindow parameter.

Method Index

 o back()
This helper method moves the cursor and the input buffer back one character.
 o backspace()
This helper method tells the JerminalWindow to delete a character backwards.
 o beginningOfLine()
This helper method moves the cursor and the input buffer index to the beginning.
 o complete()
This method handles command completion and file/path completion.
 o defaultKey(KeyEvent)
This helper method simply displays the key inputed to the JerminalWindow.
 o delete()
This helper method deletes one character at the input buffer index.
 o deleteWordBack()
This helper method deletes up to the previous whitespace or path separator or beginning of line from the input buffer index backwards.
 o deleteWordForward()
This helper method deletes up to the next whitespace or path separator or end of line from the input buffer index forward.
 o endOfLine()
This helper method moves the cursor and the input buffer index to the end.
 o forward()
This helper method moves the cursor and the input buffer forward one character.
 o getBufferIndex()
 o getInputBuffer()
 o getInsert()
 o getInterpret()
 o getJerminalWindow()
 o getKillBuffer()
 o keyBreak()
This helper method displays a '^C' on a line by itself to the JerminalWindow.
 o keyPressed(KeyEvent)
These methods implement the KeyListener interface
 o keyReleased(KeyEvent)
 o keyTyped(KeyEvent)
 o kill()
This helper method deletes all the characters from the input buffer index to the end of the input buffer and stores that String in the killBuffer.
 o lineDiff(String, String)
This helper method helps determine how many lines the Strings passed in take up in the JerminalWindow.
 o newline()
This helper method starts a newline in the JerminalWindow and flushes the input buffer to the JerminalWindow's JerminalSession (thus giving it a command).
 o next()
This helper method displays the next command in the command history to the JerminalWindow and sets the cursor and the input buffer index to the end.
 o previous()
This helper method displays the previous command in the command history to the JerminalWindow and sets the cursor and the input buffer index to the end.
 o setBufferIndex(int)
 o setInputBuffer(String)
 o setInsert(boolean)
These methods implement the JerminalKeyListener interface
 o setInterpret(boolean)
 o setJerminalWindow(JerminalWindow)
 o setKillBuffer(String)
 o wordBack()
This helper method moves the cursor and the input buffer index to the previous whitespace or path separator from the input buffer index backwards.
 o wordForward()
This helper method moves the cursor and the input buffer index to the next whitespace or path separator from the input buffer index forward.
 o yank()
This helper method inserts the killBuffer at the input buffer index and updates the JerminalWindow.

Variables

 o parent
 public JerminalWindow parent
This keylistener's parent JerminalWindow, keyboard input is read from here

 o buffer
 public StringBuffer buffer
This is the input buffer. keystrokes are appended to this buffer until a newline is read

 o index
 public int index
This is the cursor index of the input buffer. This should be in constant offset to the JerminalWindow's cursor

 o interpret
 public boolean interpret
This flag determines whether this key listener should interpret the input as Emacs keys

 o insert
 public boolean insert
This flag determines whether input should be inserted at the cursor or overwritten

 o killBuffer
 public String killBuffer
This buffer is the copy/paste buffer

 o historyIndex
 protected int historyIndex
 o tmpHistory
 protected String tmpHistory
 o shift
 protected boolean shift
 o ctrl
 protected boolean ctrl
 o alt
 protected boolean alt

Constructors

 o EmacsKeyListener
 public EmacsKeyListener(JerminalWindow parent)
This constructor assigns the parent to the JerminalWindow parameter. All fields are initialized in this constructor.

Methods

 o setInsert
 public void setInsert(boolean i)
These methods implement the JerminalKeyListener interface

 o getInsert
 public boolean getInsert()
 o setInterpret
 public void setInterpret(boolean i)
 o getInterpret
 public boolean getInterpret()
 o setKillBuffer
 public void setKillBuffer(String buff)
 o getKillBuffer
 public String getKillBuffer()
 o setInputBuffer
 public void setInputBuffer(String buff)
 o getInputBuffer
 public String getInputBuffer()
 o setBufferIndex
 public void setBufferIndex(int i)
 o getBufferIndex
 public int getBufferIndex()
 o setJerminalWindow
 public void setJerminalWindow(JerminalWindow window)
 o getJerminalWindow
 public JerminalWindow getJerminalWindow()
 o keyPressed
 public void keyPressed(KeyEvent event)
These methods implement the KeyListener interface

 o keyReleased
 public void keyReleased(KeyEvent event)
 o keyTyped
 public void keyTyped(KeyEvent event)
 o complete
 protected void complete()
This method handles command completion and file/path completion. The list of commands are given as a property in the JerminalWindow called 'commands_directory', and in this directory, this method will attempt to complete on commands. Anything that is not the first word in the input buffer is assumed to be a file/path.

 o defaultKey
 protected void defaultKey(KeyEvent event)
This helper method simply displays the key inputed to the JerminalWindow.

 o newline
 protected void newline()
This helper method starts a newline in the JerminalWindow and flushes the input buffer to the JerminalWindow's JerminalSession (thus giving it a command). The indeces and cursor is reset to the beginning.

 o backspace
 protected void backspace()
This helper method tells the JerminalWindow to delete a character backwards. The same is done in the input buffer.

 o beginningOfLine
 protected void beginningOfLine()
This helper method moves the cursor and the input buffer index to the beginning.

 o endOfLine
 protected void endOfLine()
This helper method moves the cursor and the input buffer index to the end.

 o back
 protected void back()
This helper method moves the cursor and the input buffer back one character.

 o forward
 protected void forward()
This helper method moves the cursor and the input buffer forward one character.

 o previous
 protected void previous()
This helper method displays the previous command in the command history to the JerminalWindow and sets the cursor and the input buffer index to the end.

 o next
 protected void next()
This helper method displays the next command in the command history to the JerminalWindow and sets the cursor and the input buffer index to the end.

 o keyBreak
 protected void keyBreak()
This helper method displays a '^C' on a line by itself to the JerminalWindow. Whatever was in the input buffer is cleared and nothing is sent to the JerminalSession.

 o delete
 protected void delete()
This helper method deletes one character at the input buffer index.

 o kill
 protected void kill()
This helper method deletes all the characters from the input buffer index to the end of the input buffer and stores that String in the killBuffer. The JerminalWindow is also updated.

 o yank
 protected void yank()
This helper method inserts the killBuffer at the input buffer index and updates the JerminalWindow.

 o deleteWordForward
 protected void deleteWordForward()
This helper method deletes up to the next whitespace or path separator or end of line from the input buffer index forward. The JerminalWindow is also updated.

 o deleteWordBack
 protected void deleteWordBack()
This helper method deletes up to the previous whitespace or path separator or beginning of line from the input buffer index backwards. The JerminalWindow is also updated.

 o wordForward
 protected void wordForward()
This helper method moves the cursor and the input buffer index to the next whitespace or path separator from the input buffer index forward. The JerminalWindow is updated.

 o wordBack
 protected void wordBack()
This helper method moves the cursor and the input buffer index to the previous whitespace or path separator from the input buffer index backwards. The JerminalWindow is updated.

 o lineDiff
 protected boolean lineDiff(String in1,
                            String in2)
This helper method helps determine how many lines the Strings passed in take up in the JerminalWindow. This method returns true if the 2 strings take up the same number of lines.


All Packages  Class Hierarchy  This Package  Previous  Next  Index