Cell width incorrect when using external formatting
This has already been discussed in #46 and it seemed as if this got resolved. However, it seems as if this is still an issue / reoccurred.
Here's an example when using the colored crate:
use colored::Colorize;
use prettytable::{format, row, Table};
fn main() {
let mut table = Table::new();
table.add_row(row![
"Hello".yellow(),
]);
table.printstd();
}
running this results in the following table:
+---------+
| Hello |
+---------+
you can see at the end the cell is one character too small
Probably this:
- https://github.com/phsym/prettytable-rs/blob/master/src/utils.rs#L86
Needs re-work - wanna do and send a patch that contains proper testing of it ?
I've got into the same issue after cargo update that changed unicode-width dependency version from v0.1.11 -> v0.1.13.
Adding unicode-width = "=0.1.12" to Cargo.toml workarounds the problem, so it looks like the current logic is not compatible with the following changes – https://github.com/unicode-rs/unicode-width/compare/v0.1.12...v0.1.13
Pinning dependencies asks for trouble e.g. duplication etc. It needs to be addressed here as compat issue if so.
Someone just has to work on it and submit a patch.
@pinkforest, please take a look at https://github.com/phsym/prettytable-rs/pull/170.
@pinkforest, last ping: could you please merge the PR and bump version?