@@ -335,6 +335,39 @@ The "colorful-prompts.py" example uses completion styling:
335335
336336.. image :: ../images/colorful-completions.png
337337
338+ Finally, it is possible to pass :ref: `formatted text <formatted_text >` for the
339+ ``display `` attribute of a :class: `~prompt_toolkit.completion.Completion `. This
340+ provides all the freedom you need to display the text in any possible way. It
341+ can also be combined with the ``style `` attribute. For instance:
342+
343+ .. code :: python
344+
345+
346+ from prompt_toolkit.completion import Completer, Completion
347+ from prompt_toolkit.formatted_text import HTML
348+
349+ class MyCustomCompleter (Completer ):
350+ def get_completions (self , document , complete_event ):
351+ yield Completion(
352+ ' completion1' , start_position = 0 ,
353+ display = HTML(' <b>completion</b><ansired>1</ansired>' ),
354+ style = ' bg:ansiyellow' )
355+
356+
357+ Fuzzy completion
358+ ^^^^^^^^^^^^^^^^
359+
360+ If one possible completions is "django_migrations", a fuzzy completer would
361+ allow you to get this by typing "djm" only, a subset of characters for this
362+ string.
363+
364+ Prompt_toolkit ships with a :class: `~prompt_toolkit.completion.FuzzyCompleter `
365+ and :class: `~prompt_toolkit.completion.FuzzyWordCompleter ` class. These provide
366+ the means for doing this kind of "fuzzy completion". The first one can take any
367+ completer instance and wrap it so that it becomes a fuzzy completer. The second
368+ one behaves like a :class: `~prompt_toolkit.completion.WordCompleter ` wrapped
369+ into a :class: `~prompt_toolkit.completion.FuzzyCompleter `.
370+
338371
339372Complete while typing
340373^^^^^^^^^^^^^^^^^^^^^
0 commit comments