Word wrap on multiple row and column table #2266
Replies: 2 comments
-
@rathnapandi yes, that is how the TextTable class is currently implemented: One idea to avoid this is to subclass |
Beta Was this translation helpful? Give feedback.
-
Thanks @remkop for the suggestion. Just added a dirty fix to overcome the issue. public void addRowValues(CommandLine.Help.Ansi.Text... values) {
if (values.length > columns.length) {
throw new IllegalArgumentException(values.length + " values don't fit in " +
columns.length + " columns");
}
addEmptyRow();
int oldIndent = unindent(values);
int wrap = - 1;
for (int col = 0; col < values.length; col++) {
int row = rowCount() + wrap;// write to last row: previous value may have wrapped to next row
putValue(row, col, values[col]);
CommandLine.Help.Column column = this.columns[col];
if(column.overflow == CommandLine.Help.Column.Overflow.WRAP)
wrap = row - rowCount();
}
reindent(oldIndent);
} |
Beta Was this translation helpful? Give feedback.
-
I am facing issue with word wrap on tables. If first column is wrapped, second column alignment is gone (starts with next line of first column). Find below the output.
java code
Beta Was this translation helpful? Give feedback.
All reactions