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.
Currently the logic behind -w and -H flags is not straightforward. Here are a few problems:
-H 0
is passed or not.I propose to solve some of the problems above by simplifying the logic a bit. First of all, define the units of -w as columns and units of -H as lines. Second, treat -w and -H as maximally allowed width and height of the resulting image and use the terminal measurements if they are omitted. In other words, the resulting image should always fit into a box specified by -w and -H. This also allows one to use the 2 flags together without any errors.
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing applications:
This PR intends to simplify the behavior of the program and technically some changes are breaking.
-H -1
as this will overflow the unsigned int and produce a giant positive number).-H 0
), but I could not find a rational explanation for them to provide a migration path.The PR fulfills these requirements:
fix #xxx[,#xxx]
, where "xxx" is the issue number)I did some testing in my own terminal. As the changes do not touch the actual
img_resize()
logic and only manipulate the width/height values this should be enough.If adding a new feature, the PR's description includes:
I hope my reason was convincing enough even without opening a PR =)