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
When mergin redundant ANSI Escape Sequences, the data simplifies to \x1b[0m\x1b[38;2;19;161;14m00x00000400 0000 0000 0000 0000 0000 0000 0000 0000 ................\x1b[0m
Implementation Suggestion
This could be solved by introducing a state machine which tracks the current font properties such as foreground color, background color, italic, underline, bold, etc.
Then, whenever a print to a terminal with certain font properties is requested, the state machine would check if a font mode change is required and yield a corresponding ANSI Escape Sequence prefixing the textual data.
In case the modes partially or fully match, only the shortest prefix necessary will be output, reducing redundant data.
Affected Code
code printing colored text
code related to state management regarding terminal output
For example:
- Reduced data footprint - Reduced data rate required for remote sessions - Reduced latency from start of output to appearance of text
Cons
- When output data is lost at times, (e.g. when reconnecting to a running session?) a reset might be necessary, as the state machine intrinsic to the terminal emulator might be out of sync with the one in rizin
The text was updated successfully, but these errors were encountered:
Issue
Colored output often contains redundant ANSI Escape Sequences leading to poor signal to noise ratio.
Example
To render the following single colored line of a hex dump view
0x00000400 0000 0000 0000 0000 0000 0000 0000 0000 ................
the following data has to be processed by the terminal emulator
\x1b[0m\x1b[38;2;19;161;14m0x00000400\x1b[0m \x1b[38;2;19;161;14m00\x1b[0m\x1b[38;2;19;161;14m00\x1b[0m \x1b[38;2;19;161;14m00\x1b[0m\x1b[38;2;19;161;14m00\x1b[0m \x1b[38;2;19;161;14m00\x1b[0m\x1b[38;2;19;161;14m00\x1b[0m \x1b[38;2;19;161;14m00\x1b[0m\x1b[38;2;19;161;14m00\x1b[0m \x1b[38;2;19;161;14m00\x1b[0m\x1b[38;2;19;161;14m00\x1b[0m \x1b[38;2;19;161;14m00\x1b[0m\x1b[38;2;19;161;14m00\x1b[0m \x1b[38;2;19;161;14m00\x1b[0m\x1b[38;2;19;161;14m00\x1b[0m \x1b[38;2;19;161;14m00\x1b[0m\x1b[38;2;19;161;14m00\x1b[0m \x1b[38;2;19;161;14m.\x1b[0m\x1b[38;2;19;161;14m.\x1b[0m\x1b[38;2;19;161;14m.\x1b[0m\x1b[38;2;19;161;14m.\x1b[0m\x1b[38;2;19;161;14m.\x1b[0m\x1b[38;2;19;161;14m.\x1b[0m\x1b[38;2;19;161;14m.\x1b[0m\x1b[38;2;19;161;14m.\x1b[0m\x1b[38;2;19;161;14m.\x1b[0m\x1b[38;2;19;161;14m.\x1b[0m\x1b[38;2;19;161;14m.\x1b[0m\x1b[38;2;19;161;14m.\x1b[0m\x1b[38;2;19;161;14m.\x1b[0m\x1b[38;2;19;161;14m.\x1b[0m\x1b[38;2;19;161;14m.\x1b[0m\x1b[38;2;19;161;14m.\x1b[0m \x1b[38;2;19;161;14m\n
When mergin redundant ANSI Escape Sequences, the data simplifies to
\x1b[0m\x1b[38;2;19;161;14m00x00000400 0000 0000 0000 0000 0000 0000 0000 0000 ................\x1b[0m
Implementation Suggestion
This could be solved by introducing a state machine which tracks the current font properties such as foreground color, background color, italic, underline, bold, etc.
Then, whenever a print to a terminal with certain font properties is requested, the state machine would check if a font mode change is required and yield a corresponding ANSI Escape Sequence prefixing the textual data.
In case the modes partially or fully match, only the shortest prefix necessary will be output, reducing redundant data.
Affected Code
For example:
rizin/librz/core/cmd/cmd_print.c
Line 1495 in 57f1070
Reasoning
- Reduced data rate required for remote sessions
- Reduced latency from start of output to appearance of text
The text was updated successfully, but these errors were encountered: