Class Autocomplete
Renders an overlay on another view at a given point that allows selecting
from a range of 'autocomplete' options.
Inheritance
System.Object
Autocomplete
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Terminal.Gui
Assembly: Terminal.Gui.dll
Syntax
public class Autocomplete
Properties
AllSuggestions
The full set of all strings that can be suggested.
Declaration
public List<string> AllSuggestions { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<System.String> |
CloseKey
The key that the user can press to close the currently popped autocomplete menu
Declaration
public Key CloseKey { get; set; }
Property Value
Type | Description |
---|---|
Key |
ColorScheme
The colors to use to render the overlay. Accessing this property before
the Application has been initialised will cause an error
Declaration
public ColorScheme ColorScheme { get; set; }
Property Value
Type | Description |
---|---|
ColorScheme |
MaxHeight
The maximum number of visible rows in the autocomplete dropdown to render
Declaration
public int MaxHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
MaxWidth
The maximum width of the autocomplete dropdown
Declaration
public int MaxWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
ScrollOffset
When more suggestions are available than can be rendered the user
can scroll down the dropdown list. This indicates how far down they
have gone
Declaration
public int ScrollOffset { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
SelectedIdx
The currently selected index into Suggestions that the user has highlighted
Declaration
public int SelectedIdx { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
SelectionKey
The key that the user must press to accept the currently selected autocomplete suggestion
Declaration
public Key SelectionKey { get; set; }
Property Value
Type | Description |
---|---|
Key |
Suggestions
The strings that form the current list of suggestions to render
based on what the user has typed so far.
Declaration
public ReadOnlyCollection<string> Suggestions { get; protected set; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.ReadOnlyCollection<System.String> |
Visible
True if the autocomplete should be considered open and visible
Declaration
protected bool Visible { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
ClearSuggestions()
Clears Suggestions
Declaration
public void ClearSuggestions()
EnsureSelectedIdxIsValid()
Updates SelectedIdx to be a valid index within Suggestions
Declaration
public void EnsureSelectedIdxIsValid()
GenerateSuggestions(TextView)
Populates Suggestions with all strings in AllSuggestions that
match with the current cursor position/text in the
hostControl
Declaration
public void GenerateSuggestions(TextView hostControl)
Parameters
Type | Name | Description |
---|---|---|
TextView | hostControl | The text view that you want suggestions for |
IsWordChar(Rune)
Return true if the given symbol should be considered part of a word
and can be contained in matches. Base behaviour is to use System.Char.IsLetterOrDigit(System.Char)
Declaration
public virtual bool IsWordChar(Rune rune)
Parameters
Type | Name | Description |
---|---|---|
System.Rune | rune |
Returns
Type | Description |
---|---|
System.Boolean |
ProcessKey(TextView, KeyEvent)
Handle key events before
hostControl
e.g. to make key events like
up/down apply to the autocomplete control instead of changing the cursor position in
the underlying text view.
Declaration
public bool ProcessKey(TextView hostControl, KeyEvent kb)
Parameters
Type | Name | Description |
---|---|---|
TextView | hostControl | |
KeyEvent | kb |
Returns
Type | Description |
---|---|
System.Boolean |
RenderOverlay(View, Point)
Renders the autocomplete dialog inside the given
view
at the
given point.
Declaration
public void RenderOverlay(View view, Point renderAt)
Parameters
Type | Name | Description |
---|---|---|
View | view | The view the overlay should be rendered into |
Point | renderAt |