Skip to content

reset output style at the start of each line

Benjamin Lee requested to merge benjamin/engage:reset-styling-each-line into main

Previously, any command that carried over color or other style between lines would cause the style of the task prefix to be mangled. With this change, the style is reset at the beginning of each line before printing the task prefix, so the style of the prefix should be consistent.

This isn't a complete solution, however, since commands may have expected the style settings from the previous line to carry over. Now, text that was intended to be styled by the command might be output with the default style. Effectively, this change trades off the engage UI being mangled in some situations for task output being mangled in some situations.

Since there's no way to "save and restore" style information with pure ANSI escapes, solving this problem in the general case is tricky. It would likely require parsing all the ANSI escapes in the command output ourselves, and intrepreting them to determine how to correctly restore the style before printing command output for each line.

Before: image

After: image

Merge request reports