Tickit::Widget::Entry::Plugin::Completion(3pm) | User Contributed Perl Documentation | Tickit::Widget::Entry::Plugin::Completion(3pm) |
"Tickit::Widget::Entry::Plugin::Completion" - add word-completion logic to a Tickit::Widget::Entry
use Tickit::Widget::Entry; use Tickit::Widget::Entry::Plugin::Completion; my $entry = Tickit::Widget::Entry->new( ... ); Tickit::Widget::Entry::Plugin::Completion->apply( $entry, words => [ make_words() ], ); ...
This package applies code to a Tickit::Widget::Entry instance to implement word-completion logic while editing. This logic is activated by pressing the "<Tab>" key.
If the word currently being edited has a unique match in the list of words, then the word is completed entirely, followed by a space.
If there are multiple words that could complete from the word at the cursor, then a popup menu is presented showing the next available characters or matches. The user can continue typing more characters to narrow down the choice until a unique match is found.
Tickit::Widget::Entry::Plugin::Completion->apply( $entry, %params )
Applies the plugin code to the given Tickit::Widget::Entry instance.
The following named parameters are recognised
@words = $gen_words->( %args )
A CODE reference to a subroutine used to generate the list of words at the current position. It is passed the following name/value pairs to assist it:
When this is disabled, the completion logic will apply longest-prefix matching on the set of available words, but will not otherwise display or offer any interactive UI on the list of matches.
Paul Evans <leonerd@leonerd.org.uk>
2022-12-17 | perl v5.36.0 |