Table of Contents

Class Autocomplete

Namespace
Terminal.Gui
Assembly
Terminal.Gui.dll

Renders an overlay on another view at a given point that allows selecting from a range of 'autocomplete' options.

public abstract class Autocomplete : IAutocomplete
Inheritance
Autocomplete
Implements
Derived
Inherited Members

Properties

AllSuggestions

The full set of all strings that can be suggested.

CloseKey

The key that the user can press to close the currently popped autocomplete menu

ColorScheme

The colors to use to render the overlay. Accessing this property before the Application has been initialized will cause an error

HostControl

The host control to handle.

MaxHeight

The maximum number of visible rows in the autocomplete dropdown to render

MaxWidth

The maximum width of the autocomplete dropdown

PopupInsideContainer

Gets or sets If the popup is displayed inside or outside the host limits.

Reopen

The key that the user can press to reopen the currently popped autocomplete menu

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

SelectedIdx

The currently selected index into Suggestions that the user has highlighted

SelectionKey

The key that the user must press to accept the currently selected autocomplete suggestion

Suggestions

The strings that form the current list of suggestions to render based on what the user has typed so far.

Visible

True if the autocomplete should be considered open and visible

Methods

ClearSuggestions()

Clears Suggestions

Close()

Closes the Autocomplete context menu if it is showing and ClearSuggestions()

DeleteTextBackwards()

Deletes the text backwards before insert the selected text in the HostControl.

EnsureSelectedIdxIsValid()

Updates SelectedIdx to be a valid index within Suggestions

GenerateSuggestions(int)

Populates Suggestions with all strings in AllSuggestions that match with the current cursor position/text in the HostControl

GetCurrentWord(int)

Returns the currently selected word from the HostControl.

When overriding this method views can make use of IdxToWord(List<Rune>, int, int)

IdxToWord(List<Rune>, int, int)

Given a line of characters, returns the word which ends at idx or null. Also returns null if the idx is positioned in the middle of a word.

Use this method to determine whether autocomplete should be shown when the cursor is at a given point in a line and to get the word from which suggestions should be generated. Use the columnOffset to indicate if search the word at left (negative), at right (positive) or at the current column (zero) which is the default.

InsertSelection(string)

Called when the user confirms a selection at the current cursor location in the HostControl. The accepted string is the full autocomplete word to be inserted. Typically a host will have to remove some characters such that the accepted string completes the word instead of simply being appended.

InsertText(string)

Inser the selected text in the HostControl.

IsWordChar(Rune)

Return true if the given symbol should be considered part of a word and can be contained in matches. Base behavior is to use IsLetterOrDigit(char)

MouseEvent(MouseEvent, bool)

Handle mouse events before HostControl e.g. to make mouse events like report/click apply to the autocomplete control instead of changing the cursor position in the underlying text view.

MoveDown()

Moves the selection in the Autocomplete context menu down one

MoveUp()

Moves the selection in the Autocomplete context menu up one

ProcessKey(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.

RenderOverlay(Point)

Renders the autocomplete dialog inside or outside the given HostControl at the given point.

RenderSelectedIdxByMouse(MouseEvent)

Render the current selection in the Autocomplete context menu by the mouse reporting.

ReopenSuggestions()

Reopen the popup after it has been closed.

Select()

Completes the autocomplete selection process. Called when user hits the SelectionKey.