Repository navigation
Prevent QuitSmall from truncating no-wrap output - #1211
chapmanjacobd wants to merge 2 commits into
Conversation
When wrapping is disabled, QuitSmall previously considered a long line to fit because it only compared rendered height. It then wrote the clipped current screen on exit. Keep the viewer open whenever no-wrap content exceeds the available width.
|
Thank you for the report and for taking the time to investigate this behavior. I think the current behavior is intentional. With --wrap=none, QuitSmall checks whether the content fits vertically, not whether every line fits horizontally. This can be useful when only the visible part of a long line matters—for example, ps u | ov -F --wrap=none, where the command’s trailing options may not be needed. If users want to inspect the rest of a long line, they can omit -F and scroll horizontally. IsWriteOriginal also lets users choose whether the exit output uses the original text or the current screen. Given these use cases, I’d prefer to keep the current behavior rather than prevent QuitSmall from exiting when a line is wider than the screen. Thanks again for raising the issue. |
|
I understand the fix, but I'm not sure when this option would be needed. Could you explain the use case? |
|
Sure... The use case is that you like the default of QuitSmall: true And you're running a command that takes a long time and/or can only be run once and you want to see the output in a pager. Losing the information by default is unexpected as someone who would often run |
Problem
With
QuitSmallenabled and wrapping disabled,docSmallonly checked the rendered height but not width. A single line wider than the terminal was therefore treated as fitting on one screen, and the automatic exit path wrote only the clipped current screen. I can't think of a situation where I as a user would prefer this behavior so I am pretty sure this is unintended. A bug. But if not, I could change it to a config option... maybeQuitSmallNoWrap?Fix
Keep
ovopen when no-wrap content exceeds the available body width. This lets users scroll horizontally instead of losing text. Wrapped output keeps the existing height-based behavior.Validation
go test ./...go vet ./...