namespace Terminal.Gui.Views;
///
/// Default implementation of , performs
/// case-insensitive (see ) matching of items based on
/// .
///
internal class DefaultCollectionNavigatorMatcher : ICollectionNavigatorMatcher
{
/// The comparer function to use when searching the collection.
public StringComparison Comparer { get; set; } = StringComparison.InvariantCultureIgnoreCase;
///
public bool IsMatch (string search, object? value) { return value?.ToString ()?.StartsWith (search, Comparer) ?? false; }
///
/// Returns true if is key searchable key (e.g. letters, numbers, etc) that are valid to pass
/// to this class for search filtering.
///
///
///
public bool IsCompatibleKey (Key key)
{
Rune rune = key.AsRune;
return rune != default && !Rune.IsControl (rune);
}
}