org.crsh.console
Class Editor

java.lang.Object
  extended by org.crsh.console.Plugin
      extended by org.crsh.console.Editor

 class Editor
extends Plugin

An editor state machine. todo: - undo - optimize operation with an improvement of EditorBuffer

Author:
Julien Viet

Field Summary
(package private)  EditorBuffer buffer
          .
(package private)  Console console
          .
(package private)  LinkedList<String> history
          .
(package private)  String historyBuffer
          .
(package private)  int historyCursor
          .
(package private)  StringBuilder killBuffer
          The buffer that holds what we kill.
(package private)  LineParser lineParser
          The line parser : updated on enter key.
private  Mode mode
          .
private  ArrayList<Runnable> modeListeners
          .
private static ConsoleDriver NULL
           
(package private)  MultiLineVisitor visitor
          .
 
Constructor Summary
Editor(Console console)
           
Editor(Console console, boolean echo)
           
 
Method Summary
(package private)  void addModeListener(Runnable runnable)
           
(package private)  void addToHistory(String line)
           
(package private)  String append(EditorAction action, int[] sequence)
           
(package private)  String getCurrentLine()
           
(package private)  int getCurrentPosition()
           
(package private)  int getCursorBound()
          Returns the right cursor bound depending on the current mode.
(package private)  String getKillBuffer()
           
(package private)  Mode getMode()
           
(package private)  boolean isEmpty()
           
(package private)  void reset()
           
(package private)  void setKillBuffer(CharSequence s)
           
(package private)  void setMode(Mode mode)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

console

final Console console
.


buffer

final EditorBuffer buffer
.


visitor

final MultiLineVisitor visitor
.


lineParser

final LineParser lineParser
The line parser : updated on enter key.


history

final LinkedList<String> history
.


mode

private Mode mode
.


historyCursor

int historyCursor
.


historyBuffer

String historyBuffer
.


killBuffer

final StringBuilder killBuffer
The buffer that holds what we kill.


modeListeners

private final ArrayList<Runnable> modeListeners
.


NULL

private static final ConsoleDriver NULL
Constructor Detail

Editor

Editor(Console console)

Editor

Editor(Console console,
       boolean echo)
Method Detail

getMode

Mode getMode()

setMode

void setMode(Mode mode)

addModeListener

void addModeListener(Runnable runnable)

addToHistory

void addToHistory(String line)

getCursorBound

int getCursorBound()
Returns the right cursor bound depending on the current mode.

Returns:
the current bound

getKillBuffer

String getKillBuffer()

setKillBuffer

void setKillBuffer(CharSequence s)

isEmpty

boolean isEmpty()

getCurrentLine

String getCurrentLine()

getCurrentPosition

int getCurrentPosition()

append

String append(EditorAction action,
              int[] sequence)

reset

void reset()


Copyright © 2015 eXo Platform SAS. All Rights Reserved.