-
Notifications
You must be signed in to change notification settings - Fork 12
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 Owl.Data.from_ansidata/1
#11
Conversation
b69001f
to
ba65199
Compare
f6252de
to
034314c
Compare
Rebased with |
Played a bit with it. Looks nice, good job.
|
This is a documented limitation for now, see here. It wouldn't be too hard to parse binaries to split out escape sequences in the future, but I chose not to add that for this first iteration. I agree that it would be nice to have in order to consume data from cmd. My personal use-case was focusing on consuming ansidata from Edit to add: Another edge-case if we get into parsing escape sequences that are embedded in binaries: Given this, probably the best way to handle this would be to toss the existing code that traverses ansidata and just |
Yes, let's do binary parsing in a new iteration. Thank you for the PR! ❤️ |
end | ||
|
||
defp reverse_and_tag(sequences, [%Owl.Tag{sequences: last_sequences} | _] = data) do | ||
maybe_wrap_to_tag(sequences -- last_sequences, Enum.reverse(data)) | ||
defp do_from_ansidata(integer, open_tags) when is_integer(integer) do |
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.
Looking at coverage and this line is red. This is for char list, right?
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.
Yeah, it’s just to handle individual character literals in ansidata. [“hello”, \?]
Should’ve added a test, sorry!
Implements #9.
This isn't quite ready to merge, but wanted to open it as a draft for now. The primary things left are to add docs and quite a lot more tests.Notes:
Owl.Data.Sequence
module that takes a similar approach toIO.ANSI
. It's responsible for identifying escape sequences, grouping sequences into types, knowing what the defaults are, etc.maybe_wrap_to_tag
,reverse_and_tag
, andcollapse_sequences
are unchanged, just moved.Example: