Add file path to progress output #4764
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #4752
This refactors the
progress
module, removes theterminal
module that was added in #4656, adds support for substitutions in format strings with dynamic/variable lengths, and finally adds a new format string that includes the file path. Paths now get truncated in a proper way, and the whole available space is used. Once not enough space is available for the path to be shown in a proper/usable way (at least 15 characters), then it'll fall back to the next format.Didn't test on Windows. There's a special case when adding space characters to the output, where it removes one character. Since the non-space characters don't get covered by this special case, it's possible that the line will overflow. Need to check this later.
Also didn't test with paths that include CJK characters with widths larger than 1. After the changes of #4656, the whole character width calculation was unused, as there was no user-generated content in the progress output. Now that's obviously changed with the addition of the path, but the
cut()
method should still do its job according to the tests, so I don't think there will be an issue here.