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.
-
alt
-
-
buffer
- This is the input buffer.
-
ctrl
-
-
historyIndex
-
-
index
- This is the cursor index of the input buffer.
-
insert
- This flag determines whether input should be inserted at the cursor or overwritten
-
interpret
- This flag determines whether this key listener should interpret the input as Emacs keys
-
killBuffer
- This buffer is the copy/paste buffer
-
parent
- This keylistener's parent JerminalWindow, keyboard input is read from here
-
shift
-
-
tmpHistory
-
-
EmacsKeyListener(JerminalWindow)
- This constructor assigns the parent to the JerminalWindow parameter.
-
back()
- This helper method moves the cursor and the input buffer back one character.
-
backspace()
- This helper method tells the JerminalWindow to delete a character backwards.
-
beginningOfLine()
- This helper method moves the cursor and the input buffer index to the beginning.
-
complete()
- This method handles command completion and file/path completion.
-
defaultKey(KeyEvent)
- This helper method simply displays the key inputed to the JerminalWindow.
-
delete()
- This helper method deletes one character at the input buffer index.
-
deleteWordBack()
- This helper method deletes up to the previous whitespace or path separator or beginning of line from the
input buffer index backwards.
-
deleteWordForward()
- This helper method deletes up to the next whitespace or path separator or end of line from the
input buffer index forward.
-
endOfLine()
- This helper method moves the cursor and the input buffer index to the end.
-
forward()
- This helper method moves the cursor and the input buffer forward one character.
-
getBufferIndex()
-
-
getInputBuffer()
-
-
getInsert()
-
-
getInterpret()
-
-
getJerminalWindow()
-
-
getKillBuffer()
-
-
keyBreak()
- This helper method displays a '^C' on a line by itself to the JerminalWindow.
-
keyPressed(KeyEvent)
- These methods implement the KeyListener interface
-
keyReleased(KeyEvent)
-
-
keyTyped(KeyEvent)
-
-
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.
-
lineDiff(String, String)
- This helper method helps determine how many lines the Strings passed in take up in the
JerminalWindow.
-
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).
-
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.
-
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.
-
setBufferIndex(int)
-
-
setInputBuffer(String)
-
-
setInsert(boolean)
- These methods implement the JerminalKeyListener interface
-
setInterpret(boolean)
-
-
setJerminalWindow(JerminalWindow)
-
-
setKillBuffer(String)
-
-
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.
-
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.
-
yank()
- This helper method inserts the killBuffer at the input buffer index and updates the
JerminalWindow.
parent
public JerminalWindow parent
- This keylistener's parent JerminalWindow, keyboard input is read from here
buffer
public StringBuffer buffer
- This is the input buffer. keystrokes are appended to this buffer until a newline is read
index
public int index
- This is the cursor index of the input buffer. This should be in constant offset to the JerminalWindow's cursor
interpret
public boolean interpret
- This flag determines whether this key listener should interpret the input as Emacs keys
insert
public boolean insert
- This flag determines whether input should be inserted at the cursor or overwritten
killBuffer
public String killBuffer
- This buffer is the copy/paste buffer
historyIndex
protected int historyIndex
tmpHistory
protected String tmpHistory
shift
protected boolean shift
ctrl
protected boolean ctrl
alt
protected boolean alt
EmacsKeyListener
public EmacsKeyListener(JerminalWindow parent)
- This constructor assigns the parent to the JerminalWindow parameter. All fields are
initialized in this constructor.
setInsert
public void setInsert(boolean i)
- These methods implement the JerminalKeyListener interface
getInsert
public boolean getInsert()
setInterpret
public void setInterpret(boolean i)
getInterpret
public boolean getInterpret()
setKillBuffer
public void setKillBuffer(String buff)
getKillBuffer
public String getKillBuffer()
setInputBuffer
public void setInputBuffer(String buff)
getInputBuffer
public String getInputBuffer()
setBufferIndex
public void setBufferIndex(int i)
getBufferIndex
public int getBufferIndex()
setJerminalWindow
public void setJerminalWindow(JerminalWindow window)
getJerminalWindow
public JerminalWindow getJerminalWindow()
keyPressed
public void keyPressed(KeyEvent event)
- These methods implement the KeyListener interface
keyReleased
public void keyReleased(KeyEvent event)
keyTyped
public void keyTyped(KeyEvent event)
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.
defaultKey
protected void defaultKey(KeyEvent event)
- This helper method simply displays the key inputed to the JerminalWindow.
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.
backspace
protected void backspace()
- This helper method tells the JerminalWindow to delete a character backwards. The same is
done in the input buffer.
beginningOfLine
protected void beginningOfLine()
- This helper method moves the cursor and the input buffer index to the beginning.
endOfLine
protected void endOfLine()
- This helper method moves the cursor and the input buffer index to the end.
back
protected void back()
- This helper method moves the cursor and the input buffer back one character.
forward
protected void forward()
- This helper method moves the cursor and the input buffer forward one character.
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.
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.
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.
delete
protected void delete()
- This helper method deletes one character at the input buffer index.
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.
yank
protected void yank()
- This helper method inserts the killBuffer at the input buffer index and updates the
JerminalWindow.
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.
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.
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.
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.
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