Strip OSC and DCS sequences to support e.g. OSC 8 hyperlinks over tmux. - #280
Conversation
|
Appreciate the clean commit history, but it looks like there's a fair bit of code duplication. Could that be deduplicated? (If not, why not?) |
@djc Just my editorial choice to keep things simple. Did you have something more like the following (see latest commit) in mind? It's more complex but clarifies intent. (Happy to squash if you like it, honestly I kind of do.) Either way, I think the new commit at least clearly shows why there is some subtlety due to the differences in OSC and DCS semantics/idiosyncrasies---two examples:
Let me know what you like! |
3d2f8f2 to
07d3b28
Compare
|
(Sorry about the noise I was bikeshedding a function name.) |
djc
left a comment
There was a problem hiding this comment.
I definitely like it better too -- please squash.
Is there existing stuff which could leverage the same trait?
|
If there's a natural other place the same trait fits, I can't seem to find it. I would say the DFA core is structurally a bit different. (Above are my subjective feelings about your comments and they are made with relatively little conviction, so please feel free to override if you feel more strongly.) |
|
@djc (The politest possible) ping, just in case this fell off your desk (as opposed to being placed in the filing cabinet 😄). Obviously no pressure. |
|
I'll have you know my GitHub notifications are neatly stacked in a filing cabinet 😄, but due to various factors (including vacation) the cabinet is rather full at the moment -- ping me again if I haven't gotten to it in a month, okay? |
|
@djc polite ping! :) |
djc
left a comment
There was a problem hiding this comment.
Thanks for your patience! This needs a rebase and a few more tweaks.
Treat OSC and DCS control strings, including tmux passthrough wrappers, as non-printing when iterating or stripping ANSI codes. Include the Zellij fixture in packaged sources for the parser regression tests.
|
@djc Rebased onto current main, squashed to one commit, and (I believe) addressed both remaining inline suggestions. Sorry about falling off the face of the earth! |
|
Thanks! |
|
Released in 0.16.5. |
Bumps console from 0.16.4 to 0.16.6. Release notes Sourced from console's releases. 0.16.6 What's Changed Fix truncate_str panicking mid-character without ansi-parsing by @lenamonj in console-rs/console#296 perf: accelerate printable ASCII text width by @dexhunter in console-rs/console#297 fix: measure the truncation tail in visible columns, not raw width by @youdie006 in console-rs/console#298 Prepare 0.16.6 by @djc in console-rs/console#299 0.16.5 What's Changed Strip OSC and DCS sequences to support e.g. OSC 8 hyperlinks over tmux. by @khoek in console-rs/console#280 Commits 4329b77 Bump version to 0.16.6 bdf46b0 utils: wrap tests in module 4f54213 fix: measure the truncation tail in visible columns ed342d0 test: consolidate text width regression coverage 48b99e9 perf: accelerate printable ASCII text width abf0358 Fix truncate_str panicking mid-character without ansi-parsing ac3cb73 Bump version to 0.16.5 97a91ae ansi: strip OSC and DCS sequences See full diff in compare view Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase. Dependabot commands and options You can trigger Dependabot actions by commenting on this PR: @dependabot rebase will rebase this PR @dependabot recreate will recreate this PR, overwriting any edits that have been made to it @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
I noticed that using
indicatif(and friends) to embed a hyperlink in a console progress bar caused the wheels to fall off my app (with many newlines being spammed to the console and the auto-updating line-rewriting broken). I tracked the problem down to the OSC sequences incorrectly being interpreted as printable, and the following patch fixes the problem for me.