C# Class IrcShark.Extensions.Terminal.History

The History saves a list of typed commands on the console and provides methods to switch through the saved commands.
This code bases on Miguel de Icaza's ([email protected]) LineEditor from the mono project. It was changed to fit the needs of IrcShark and its coding standards.
Afficher le fichier Open project: hapm/IrcShark Class Usage Examples

Méthodes publiques

Méthode Description
Accept ( string s ) : void

Overrides the lastly added history item.

Append ( string s ) : void

Appends a value to the history.

CursorToEnd ( ) : void

Moves the cursor to the end of the history.

History ( int size ) : System

Initializes a new instance of the History class.

History ( int size, string savedHistory ) : System

Initializes a new instance of the History class.

Next ( ) : string

Moves the cursor to the next item if possible, and returns it.

NextAvailable ( ) : bool

Checks if there is a next item after the current item under the cursor.

Previous ( ) : string

Moves the cursor to the previous item if possible, and returns it.

PreviousAvailable ( ) : bool

Checks if there is a previous item before the current item under the cursor.

RemoveLast ( ) : void

Removes the last item that was added to the History.

SearchBackward ( string term ) : string

Searches a given term in the history backwards, from newest to oldest command.

Update ( string s ) : void

Updates the current cursor location with the string, to support editing of history items.

For the current line to participate, an Append must be done before.

Private Methods

Méthode Description
Close ( ) : void

Method Details

Accept() public méthode

Overrides the lastly added history item.
public Accept ( string s ) : void
s string The new value to add.
Résultat void

Append() public méthode

Appends a value to the history.
public Append ( string s ) : void
s string The value to append.
Résultat void

CursorToEnd() public méthode

Moves the cursor to the end of the history.
public CursorToEnd ( ) : void
Résultat void

History() public méthode

Initializes a new instance of the History class.
Thrown if size is smaller than 1.
public History ( int size ) : System
size int The number of commands, this history instance can save.
Résultat System

History() public méthode

Initializes a new instance of the History class.
Thrown if size is smaller than 1 or than the length of the savedHistory array.
public History ( int size, string savedHistory ) : System
size int The number of commands, this history instance can save.
savedHistory string An array of saved commands, that should be loaded to the History on initialisation.
Résultat System

Next() public méthode

Moves the cursor to the next item if possible, and returns it.
public Next ( ) : string
Résultat string

NextAvailable() public méthode

Checks if there is a next item after the current item under the cursor.
public NextAvailable ( ) : bool
Résultat bool

Previous() public méthode

Moves the cursor to the previous item if possible, and returns it.
public Previous ( ) : string
Résultat string

PreviousAvailable() public méthode

Checks if there is a previous item before the current item under the cursor.
public PreviousAvailable ( ) : bool
Résultat bool

RemoveLast() public méthode

Removes the last item that was added to the History.
public RemoveLast ( ) : void
Résultat void

SearchBackward() public méthode

Searches a given term in the history backwards, from newest to oldest command.
public SearchBackward ( string term ) : string
term string The term to search for.
Résultat string

Update() public méthode

Updates the current cursor location with the string, to support editing of history items.
For the current line to participate, an Append must be done before.
public Update ( string s ) : void
s string The new value for the history item at the current location.
Résultat void