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

fix TableOutput spaces when using long words (DAT-10069) #2879

Merged
merged 3 commits into from
May 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ private static String padColumn(String col, int maxWidth) {
* @return the new current running width
*/
private static int doAppend(int runningWidth, String part, int maxWidth, StringBuilder result) {
// If a word that is longer than the maxWidth is appended before this method is called, it will spill onto
// multiple lines, and we only care about the runningWidth of the last line.
if (runningWidth > maxWidth) {
runningWidth = runningWidth % maxWidth;
}
int spaceWidth = runningWidth > 0 ? 1 : 0;
if (runningWidth + (part.length() + spaceWidth) > maxWidth) {
runningWidth = fillLineWithSpaces(runningWidth, maxWidth, result);
Expand Down