You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Colorama is a wonderful hack that wraps stdout to process ansi codes. It is problematic today because it is essentially a global setting and interferes with the ability to enable ansi escape sequences with newer Windows.
We should replace Colorama with equivalent functionality within Rich itself that generates the appropriate win32 api calls. This will hopefully be a little faster, and give us much more granular control over when to enable it.
I think we can do this at the Segment level. In Console, there is a _render_buffer method which renders segments in to text with ansi codes. I think we can generate the appropriate calls to the win32 api call here, if self.legacy_windows is True.
Since the win32 calls are only available on Windows, this should probably implemented within a conditional import. Perhaps _windows_renderer.py
See the Win32 docs for a reference on the appropriate API calls. It may also be worth referring to the colorama source.
I suggested we might have to process ansi codes to extract the win32 calls. On reflection I don't think we will need this. There is enough information in the Segment object that we don't need to parse anything. This should make it significantly faster.
The text was updated successfully, but these errors were encountered:
Colorama is a wonderful hack that wraps stdout to process ansi codes. It is problematic today because it is essentially a global setting and interferes with the ability to enable ansi escape sequences with newer Windows.
We should replace Colorama with equivalent functionality within Rich itself that generates the appropriate win32 api calls. This will hopefully be a little faster, and give us much more granular control over when to enable it.
I think we can do this at the Segment level. In Console, there is a
_render_buffer
method which renders segments in to text with ansi codes. I think we can generate the appropriate calls to the win32 api call here, ifself.legacy_windows
is True.Since the win32 calls are only available on Windows, this should probably implemented within a conditional import. Perhaps
_windows_renderer.py
See the Win32 docs for a reference on the appropriate API calls. It may also be worth referring to the colorama source.
https://docs.microsoft.com/en-us/windows/console/console-screen-buffers#character-attributes
I suggested we might have to process ansi codes to extract the win32 calls. On reflection I don't think we will need this. There is enough information in the
Segment
object that we don't need to parse anything. This should make it significantly faster.The text was updated successfully, but these errors were encountered: