euporie.core.widgets.forms.WordCompleter

class euporie.core.widgets.forms.WordCompleter(words: list[str] | Callable[[], list[str]], ignore_case: bool = False, display_dict: Mapping[str, AnyFormattedText] | None = None, meta_dict: Mapping[str, AnyFormattedText] | None = None, WORD: bool = False, sentence: bool = False, match_middle: bool = False, pattern: Pattern[str] | None = None)

Simple autocompletion on a list of words.

Parameters:
  • words – List of words or callable that returns a list of words.

  • ignore_case – If True, case-insensitive completion.

  • meta_dict – Optional dict mapping words to their meta-text. (This should map strings to strings or formatted text.)

  • WORD – When True, use WORD characters.

  • sentence – When True, don’t complete by comparing the word before the cursor, but by comparing all the text before the cursor. In this case, the list of words is just a list of strings, where each string can contain spaces. (Can not be used together with the WORD option.)

  • match_middle – When True, match not only the start, but also in the middle of the word.

  • pattern – Optional compiled regex for finding the word before the cursor to complete. When given, use this regex pattern instead of default one (see document._FIND_WORD_RE)