-
Notifications
You must be signed in to change notification settings - Fork 115
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
Added fn from_ansi_str for StyledObject #167
base: main
Are you sure you want to change the base?
Conversation
this is method can parse a string with ansi escape code and return a vector of StyledObject
This looks good but I think it would be better to change this to return an Iterator instead. Also please add an example docstring showing this is to be used, maybe just use the example from #166. |
Refactor parser into iterator, and provide it together with AnsiCodeIterator following ansi_parse feature, optimize unit test |
Any suggestions on where to add more documentation? |
@mitsuhiko can you review this pr |
@@ -21,6 +21,7 @@ ansi-parsing = [] | |||
libc = "0.2.30" | |||
unicode-width = { version = "0.1", optional = true } | |||
lazy_static = "1.4.0" | |||
regex = "1.4.2" |
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.
This should be an optional dependency. Code that depends on it then should also be feature gated.
@@ -419,6 +421,23 @@ impl Style { | |||
} | |||
} | |||
|
|||
impl Style { | |||
pub fn get_fg(&self) -> Option<Color> { |
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.
Why are these APIs added? Let's not add these unless there is a reason (maybe follow up PR), and if they are added, they need docs.
this is method can parse a string with ansi escape code and return a vector of StyledObject