C# Класс 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.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
Close ( ) : void

Описание методов

Accept() публичный Метод

Overrides the lastly added history item.
public Accept ( string s ) : void
s string The new value to add.
Результат void

Append() публичный Метод

Appends a value to the history.
public Append ( string s ) : void
s string The value to append.
Результат void

CursorToEnd() публичный Метод

Moves the cursor to the end of the history.
public CursorToEnd ( ) : void
Результат void

History() публичный Метод

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.
Результат System

History() публичный Метод

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.
Результат System

Next() публичный Метод

Moves the cursor to the next item if possible, and returns it.
public Next ( ) : string
Результат string

NextAvailable() публичный Метод

Checks if there is a next item after the current item under the cursor.
public NextAvailable ( ) : bool
Результат bool

Previous() публичный Метод

Moves the cursor to the previous item if possible, and returns it.
public Previous ( ) : string
Результат string

PreviousAvailable() публичный Метод

Checks if there is a previous item before the current item under the cursor.
public PreviousAvailable ( ) : bool
Результат bool

RemoveLast() публичный Метод

Removes the last item that was added to the History.
public RemoveLast ( ) : void
Результат void

SearchBackward() публичный Метод

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.
Результат string

Update() публичный Метод

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.
Результат void