Class InputHistory
Default ring-buffer based implementation of IInputHistory. Stores input entries in a Scylla.Core.Structures.ScyllaRingBuffer<T> and supports up/down navigation through the history. Consecutive duplicate entries are skipped when adding.
Implements
Inherited Members
Namespace: Scylla.TextMode
Assembly: ScyllaTextMode.dll
Syntax
public sealed class InputHistory : IInputHistory
Constructors
InputHistory(int)
Creates a new InputHistory with the specified capacity.
Declaration
public InputHistory(int capacity = 100)
Parameters
| Type | Name | Description |
|---|---|---|
| int | capacity | The maximum number of entries to store. |
Fields
DEFAULT_CAPACITY
Default maximum history capacity.
Declaration
public const int DEFAULT_CAPACITY = 100
Field Value
| Type | Description |
|---|---|
| int |
Properties
Capacity
Gets the maximum number of entries that can be stored.
Declaration
public int Capacity { get; }
Property Value
| Type | Description |
|---|---|
| int |
Count
Gets the number of entries in the history.
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| int |
IsEmpty
Gets whether the history is empty.
Declaration
public bool IsEmpty { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsNavigating
Gets whether currently navigating through history.
Declaration
public bool IsNavigating { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
Add(string)
Adds an entry to the history.
Declaration
public void Add(string entry)
Parameters
| Type | Name | Description |
|---|---|---|
| string | entry | The input entry to add. |
Clear()
Clears all history entries.
Declaration
public void Clear()
NavigateDown()
Navigates down (newer) in the history.
Declaration
public string NavigateDown()
Returns
| Type | Description |
|---|---|
| string | The command at the navigation position, or the saved input if past the newest. |
NavigateUp(string)
Declaration
public string NavigateUp(string currentInput)
Parameters
| Type | Name | Description |
|---|---|---|
| string | currentInput |
Returns
| Type | Description |
|---|---|
| string |
ResetNavigation()
Resets the navigation state.
Declaration
public void ResetNavigation()