v7.0.0: TIM-v3!
This release brings completely re-written TIM implementation to the library. It is significantly faster (~2x for markup without macros, >10x for markup with macros) than the previous version, and it's a lot easier to maintain and improve upon.
The previous hyperlink syntax ([!link(https://example.org)]Example site[/!link]
) is now deprecated in favour of a new, much simpler one:
[~https://example.org]Example site[/~]
There have also been a couple of changes to SVG exports to make them more accurate and aesthetically pleasing. We also support the inverse
style for them as well!
Changelog
Changes marked in bold are API-breaking.
Additions
- Support CSS color names in TIM code (77d2ca9)
- Support terminal resize events on Windows (@Tired-Fox, #80)
- Add
ignore_any
parameter toWidget.execute_binding
(68866e6)
Bugfixes
- Fix
InputField
handling clicks & drags started outside of it (#72, #75) - Fix
CTRL_C
not killing compositor thread by making it a daemon (#78) - Fix contents of
widget.positioned_line_buffer
being duplicated before and after vertical alignment (#70)
Refactors
- Rewrite of the TIM engine (now at version 3!) (#84)
- Move TIM highlighting from an instance method to a highlighter (635b6f6)
- Move to
pyproject.toml
-based builds (#82) - Stop relying on
visibility=hidden
in SVG exports (d070724)
Removals
- Remove
get_applied_sequences
helper function (a7d41bd)
API updates
Type | Change | Alternative | Comment |
---|---|---|---|
Removal | get_applied_sequences |
A custom tokenization based implementation | This function was no longer used internally, and if someone needed it the new tokenizers are a much more performant and smart way to go about implementing it. |
Removal | MarkupLanguage.prettify_markup |
highlight_tim |
Using regex-based highlighting allows the output markup to be completely identical char-by-char to the source, whereas the previous token based implementation had a tendency to change things around. It's also much less LOC and faster. |
Deprecation | Markup hyperlink syntax !link(https://example.org) |
The new ~https://example.org syntax |
Previously hyperlinks were implemented as macros, but they were very messy under the hood. A first-class syntax for them is vastly superior. |
Refactor | The role of StyledText |
N/A | Previously, StyledText was meant to be barely detectable when used. It was returned in various places, but wanted to not be a thing you thought about often. Now it's on an opt-in basis, and it no longer tries to pass as a str . It's immutable, and is only meant to be generated by MarkupLanguage.group_styles or StyledText.group_styles . You can also now create them from markup, not just ANSI-coded text. |
Showcase
Note that since the above image,
tim-v3
went down to ~180-190 ns per parse