Export the current output width to watched program as COLUMNS
environment variable
#140
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.
This is WIP, but I'll put it here since it's:
Now that borders and scroll bars are implemented, commands I use often wrap to the wrong number of columns. This has always been the case when the history window is open. This is because they get the full terminal width from the terminal and don't know that
hwatch
is using some columns for the UI.There is, in fact, at least one standard way to address this: set the
COLUMNS
variable. Many programs, e.g.git diff --stat
and Git in general, already support it.COLUMNS is part of POSIX (apparently, the 2017 edition of the standard is freely available on that site).
My implementation works, but has one problem: COLUMNS is not set at the first program invocation, resulting in the user seeing a badly wrapped screen until the first update. Fixing this might require a bit of a refactor, I'm thinking about how best to do it.
A good way to test this is:
and then play with toggling UI/border/etc.