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

Optimize LineText::color #483

Open
zhiburt opened this issue Jan 21, 2025 · 1 comment
Open

Optimize LineText::color #483

zhiburt opened this issue Jan 21, 2025 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers papergrid refactoring

Comments

@zhiburt
Copy link
Owner

zhiburt commented Jan 21, 2025

We could eliminate most of the ANSI here

/// let mut table = Table::new(["Hello World"]);
/// table.with(LineText::new("TABLE", Rows::first()).color(Color::FG_BLUE));
///
/// assert_eq!(
/// table.to_string(),
/// "\u{1b}[34mT\u{1b}[39m\u{1b}[34mA\u{1b}[39m\u{1b}[34mB\u{1b}[39m\u{1b}[34mL\u{1b}[39m\u{1b}[34mE\u{1b}[39m---------+\n\
/// | &str |\n\
/// +-------------+\n\
/// | Hello World |\n\
/// +-------------+"
/// );

@zhiburt zhiburt changed the title Optimize LineText::color Optimize LineText::color Jan 21, 2025
@zhiburt
Copy link
Owner Author

zhiburt commented Jan 21, 2025

Maybe we must optimize the underlying structures to handle Spans rather then chars.
So we could save memory and eliminate number of lookups?
Though the insert be harder I guess

@zhiburt zhiburt added the enhancement New feature or request label Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers papergrid refactoring
Projects
None yet
Development

No branches or pull requests

1 participant