Skip to content

Upgrading prompt_toolkit 0.57 to 0.58

Breaking0.57 → 0.58Breaking5New11Changed6Fixed7

BreakingUpgrade verdict

5 breaking changes.

  • Custom user controls must now return a UIContent object made of lines.
  • Custom processors must be updated to the new one-line-at-a-time API.
  • Custom lexers must return a per-line token function, and PygmentsLexer no longer has to lex from the start of the document.
  • The wrap_lines setting now lives on Window instead of BufferControl.
Top 3 of 5 that need code or config changes

Drops pygments.

Installs 2 packages in all (was 3).

Breaking5
Changes UIControls to return a UIContent instance consisting of a collection of lines.
UIControlUIContent
Rewrites all processors with a changed API because they now process one line at a time.
Changes Lexer.lex_document to return a function returning tokens for one line, and makes PygmentsLexer lazy with optional syntax synchronization.
Lexer.lex_documentPygmentsLexer
Moves wrap_lines from BufferControl to a property of Window.
wrap_linesWindowBufferControl
Changes many internal APIs, requiring all custom UIControl, Processor and Lexer classes to be rewritten, though shortcuts.prompt stays backwards-compatible.
WindowUIControlProcessorLexershortcuts.prompt