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

Feature Request: Support ANSI color escape codes when printing tables #1243

Open
jacob-pro opened this issue Nov 29, 2023 · 0 comments
Open

Comments

@jacob-pro
Copy link

First, thank you for this useful library.

Feature Request:

ANSI escape codes can be used for controlling text colour.

Whilst these can currently be included in a string column, and will show with colour when printed in a compatible terminal, the table does not print correctly due to the cell width being calculated incorrectly.

/**
* Returns the column widths required to print the header and data
*
* @param headers the headers to print
* @param data the data items to print
* @return the required column widths
*/
private static int[] getWidths(String[] headers, String[][] data) {

It would be awesome if this library allowed for either:

a. Easily overriding the cell width used in the DataFramePrinter instead of calling .length directly. (low effort)
b. Detecting ANSI escape codes in string columns and correctly counting the actual display width (higher effort)

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

No branches or pull requests

1 participant