27 Aug 2021 23:15:55 UTC
- Distribution: Tickit-Widget-Entry-Plugin-Completion
- Module version: 0.01
- Source (raw)
- Browse (raw)
- How to Contribute
- Testers (4 / 0 / 17)
- KwaliteeBus factor: 1
- % Coverage
- License: perl_5
- Perl: v5.26.0
- Activity24 month
- Download (14.13KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionPEVANS Paul Evans
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
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
- gen_words => CODE
@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:
- words => ARRAY
A shortcut to providing
gen_words; a reference to an array containing all the possible words, in no particular order, that are offered for completion.
- use_popup => BOOL
Optional. If false, do not display a popup menu. Defaults to true.
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.
- ignore_case => BOOL
Optional. If true, word matching will be performed ignoring case, by using the
/iregexp flag. Defaults to false. When the completion logic has selected a word to insert, it may change the case of the text already in the buffer to match the completion word.
- append_after_word => STRING
Optional. If set, append this string after a successful unique match. Defaults to a single space.
Paul Evans <firstname.lastname@example.org>
Module Install Instructions
To install Tickit::Widget::Entry::Plugin::Completion, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Tickit::Widget::Entry::Plugin::Completion
For more information on module installation, please visit the detailed CPAN module installation guide.