Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using special enter/leave stderr escape sequence on DomTerm #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

PerBothner
Copy link

Stderrred doesn't work right if stderr contains escape sequences (one example is gcc). In that case only the initial part of the error message is red. This can be fixed by parsing the output looking for escape sequences (specifically "end style" sequences), but that is complex. Better would be for the terminal to understand a special escape sequence pair to delimit error messages. DomTerm defines such a pair of sequences.

Another advantage of a distinct escape sequence is that you can style it - even retroactively. DomTerm (being web-based) uses CSS, so you can use whatever style you want.

Note setting STDERRED_ESC_CODE is insufficient as it doesn't override the end_color_code. Plus it is nicer if it is automatic. An alternative way to deal with this would be to allow STDERRED_ESC_CODE to optionally contain both the start_color_code and the end_color_code, perhaps separated by a newline.

@devnoname120
Copy link

This can be fixed by parsing the output looking for escape sequences (specifically "end style" sequences), but that is complex

How is that complex?

@PerBothner
Copy link
Author

How is that complex?

Parsing terminal escape sequences is quite tricky if you want to do it correctly. To start with, you have to use a state machine - you can't use regular expressions. You should emit end_color_code before an escape, but recognizing when you should switch back (with start_color_code) is trickier. You can handle probably 99% of cases if you switch back after a letter.

I notice issue #87 is related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants