You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When glow is called by the user for the very first time (so that width is not given explicitly via -w), glow output with will be inferred from the terminal width (as I suppose it's intended). However, subsequent repetitions of the invocation will have glow output width at 80.
Setup
glow between v2.0.0 and 7b3bfac (master as of writing this).
To Reproduce
Open a shell in a terminal so that its width is way below 80.
See the line widtths when glow output witdth is expilicty set to that of the terminal:
Except for the case when the user runs this command as their very first invocation of glow - in that case we do get the expected output.
Additional context
The difference between very first invocation and subsequent ones is that upon that very first invocation glow deploys a basic configuration file. And the code that calculates the actual runtime witdth in validateOptions behaves as if it were granted that no config file exists (which holds only for the very first invocation):
width == 0 is used in the sense that width is "pristine". However, after the deployment of the config file, which includes a setting of width to 80, if -w is not passed, the execution flow will arrive to this code block with width already being 80. Ie. the pristine value is whatever what's been placed into config - a static value check cannot capture this condition.
The text was updated successfully, but these errors were encountered:
Describe the bug
When glow is called by the user for the very first time (so that width is not given explicitly via
-w
), glow output with will be inferred from the terminal width (as I suppose it's intended). However, subsequent repetitions of the invocation will have glow output width at 80.Setup
glow between v2.0.0 and 7b3bfac (master as of writing this).
To Reproduce
Open a shell in a terminal so that its width is way below 80.
See the line widtths when glow output witdth is expilicty set to that of the terminal:
(Note: the width does not stricty adhere to the specified value - cf. issue #668 - but it's at least close to the speicified witdh.)
Expected behavior without using
-w
:Actual behavior:
Except for the case when the user runs this command as their very first invocation of glow - in that case we do get the expected output.
Additional context
The difference between very first invocation and subsequent ones is that upon that very first invocation glow deploys a basic configuration file. And the code that calculates the actual runtime witdth in
validateOptions
behaves as if it were granted that no config file exists (which holds only for the very first invocation):glow/main.go
Lines 180 to 192 in 7b3bfac
width == 0
is used in the sense thatwidth
is "pristine". However, after the deployment of the config file, which includes a setting ofwidth
to 80, if-w
is not passed, the execution flow will arrive to this code block withwidth
already being 80. Ie. the pristine value is whatever what's been placed into config - a static value check cannot capture this condition.The text was updated successfully, but these errors were encountered: