less
less copied to clipboard
fix: don't twiddle null lines during `quit_if_one_screen` render
don't output tildes or blank lines if not paging a single-screen output
fixes https://github.com/gwsw/less/issues/624
test cases:
seq 5 | less -F +G
echo "single line" | less -F +G --tilde
Can you give an example where less displays tildes or blank lines on a single screen output? For example, there are no such lines if I do seq 5 | less -F.
Can you give an example where less displays tildes or blank lines on a single screen output? For example, there are no such lines if I do
seq 5 | less -F.
sorry for low detail. filed an issue after making the pr... examples are here: https://github.com/gwsw/less/issues/624
the issue is present when combined with +G like less -F +G
uncertain but this may also be relevant to https://github.com/gwsw/less/issues/28
i tried to make a test for this using lesstest, but the generated test didn't seem to notice a difference in output. does it totally ignore null lines?
it seems like using the condition with one_screen resulted in correct behavior of the pipe example, but was not successful at correcting the git pager behavior. i don't understand why that would be the case.
removing one_screen and just using quit_if_one_screen seems to produce correct behavior in both cases, and as far as i can tell doesn't result in an overeager suppression, because quit_if_one_screen is set to 'false' after the first render
https://github.com/gwsw/less/blob/6d1fcd3a35dd3467cd7266ca907e04d36cf36df2/command.c#L879-L886
okay, maybe not entirely fixes #28
the initial git diff pager example is improved - when paging, the 'pattern' option still highlights the matches, and sets up the 'next' key command. when content fits the screen, it correctly skips paging mode, without filling the screen. this could be considered 'the issue', and it is corrected by this PR.
but comments describe this case which is arguably degraded:
seq 10 | less --quit-if-one-screen +/8
it still (incorrectly?) enters paging mode, but the experience is worse because existing screen content is not cleared by the null-lines twiddle.
Fixed by addition of the --cmd option in 3979f5cb7f12480ee676311921c8d097973d9e4e.