-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add support for rendering uninterpreted/"raw" messages #9
Conversation
1b9ed14
to
55e4b13
Compare
))); | ||
tokens.push(" ".into()); | ||
tokens.push(brush.style(color.bold()).paint(message)); | ||
|
||
let message_block_count = block_count_sans_ansi_codes(&tokens); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm: it looks like unicode-width
does not ignore ANSI control characters, so raw messages containing ANSI characters do not fully overdraw. See unicode-rs/unicode-width#24.
The top commit resolves this issue, albeit in a somewhat costly way.
55e4b13
to
1c1eda2
Compare
} | ||
|
||
let mut block_counter = BlockCounter(0); | ||
let mut parser = vte::Parser::new(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Parser
is fairly hefty, and should likely be lifted onto the State
for reuse across messages.
Thanks a lot, all this looks great! Since VTE is needed for raw messages to calculate their size correctly, I am wondering if there could be a feature-toggle for the Is this feasible? |
Technically But yes: I agree that it would be good to avoid introducing the overhead of the |
It's indeed possible to feature-toggle the Raw variant of the Before doing any of this, I hope it's possible to make |
Closing due to inactivity. |
Fixes #8.