Skip to content

Conversation

@jfinkels
Copy link
Collaborator

Depends on #10474

Write the contents of the entire row to a single String before writing the full row to stdout. Before this commit, each cell was put in its own String and then that String was written to stdout before moving on to the next cell in the row. After this commit, the contents of each cell in a row is appended to a single String, and that String is written to stdout only after all cells in the row have been processed.

This change will make it much easier to make improvements to the logic of which characters to write at each point in the row, since the current logic does not match the output GNU pr very well. For example, the decision about whether to write a tab or multiple spaces requires knowing how many characters have been written in the current row, which was not easily accessible before.

Remove some unneeded parameters from the `get_line_for_printing()`
helper function since the values are already contained in the
`OutputOptions` parameter.
Write the contents of the entire row to a single String before writing
the full row to stdout. Before this commit, each cell was put in its own
String and then that String was written to stdout before moving on to
the next cell in the row. After this commit, the contents of each cell
in a row is appended to a single String, and that String is written to
stdout only after all cells in the row have been processed.

This change will make it much easier to make improvements to the logic
of which characters to write at each point in the row, since the current
logic does not match the output GNU `pr` very well. For example, the
decision about whether to write a tab or multiple spaces requires
knowing how many characters have been written in the current row, which
was not easily accessible before.
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

Successfully merging this pull request may close these issues.

1 participant