namespace Terminal.Gui.Views;
///
/// Navigates a collection of items using keystrokes. The keystrokes are used to build a search string. The
/// is used to find the next item in the collection that matches the search string when
/// is called.
///
/// If the user types keystrokes that can't be found in the collection, the search string is cleared and the next
/// item is found that starts with the last keystroke.
///
/// If the user pauses keystrokes for a short time (see ), the search string is cleared.
///
public interface ICollectionNavigator
{
///
/// Gets or sets the number of milliseconds to delay before clearing the search string. The delay is reset on each
/// call to . The default is 500ms.
///
public int TypingDelay { get; set; }
/// This event is invoked when changes. Useful for debugging.
public event EventHandler? SearchStringChanged;
///
/// Gets the current search string. This includes the set of keystrokes that have been pressed since the last
/// unsuccessful match or after ) milliseconds. Useful for debugging.
///
string SearchString { get; }
///
/// Class responsible for deciding whether given entries in the collection match
/// the search term the user is typing.
///
ICollectionNavigatorMatcher Matcher { get; set; }
///
/// Gets the index of the next item in the collection that matches the current plus the
/// provided character (typically from a key press).
///
/// The index in the collection to start the search from.
/// The character of the key the user pressed.
///
/// The index of the item that matches what the user has typed. Returns if no item in the
/// collection matched.
///
int? GetNextMatchingItem (int? currentIndex, char keyStruck);
}