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

Added fn from_ansi_str for StyledObject #167

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

BppleMan
Copy link

this is method can parse a string with ansi escape code and return a vector of StyledObject

this is method can parse a string with ansi escape code and return a vector of StyledObject
@mitsuhiko
Copy link
Collaborator

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.

@BppleMan BppleMan closed this May 19, 2023
@BppleMan BppleMan reopened this May 19, 2023
@BppleMan
Copy link
Author

Refactor parser into iterator, and provide it together with AnsiCodeIterator following ansi_parse feature, optimize unit test

@BppleMan
Copy link
Author

Any suggestions on where to add more documentation?

@BppleMan BppleMan closed this May 19, 2023
@BppleMan BppleMan reopened this May 19, 2023
@BppleMan BppleMan marked this pull request as draft May 19, 2023 10:20
@BppleMan BppleMan marked this pull request as ready for review May 19, 2023 10:20
@BppleMan BppleMan marked this pull request as draft May 19, 2023 10:20
@BppleMan BppleMan marked this pull request as ready for review May 22, 2023 02:38
@BppleMan
Copy link
Author

@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"
Copy link
Collaborator

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> {
Copy link
Collaborator

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.

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.

None yet

2 participants