-X is a workaround for the previous behavior of -F, but it's not a great
solution. By not sending the terminal init sequence, some things can be
broken, depending on the terminal. For example, some terminals send the
"wrong" sequences for the arrow keys when the terminal doesn't receive
the init sequence. For that reason and similar ones, I've never liked
-X. The change in behavior for -F was to deal with some other types of
(arguably broken) terminals that switch to an alternate screen when they
receive the init sequence. This makes -F fairly useless on such
terminals. However this does change the behavior to the one Linus
objected to, where the first page is not output until we know whether it
fits on the screen, so any delays in the first screen will delay all
output. (Note that this doesn't happen for delays that occur after the
first screen has been displayed.)
So I'm not sure what the best solution is. Linus's proposal to disable
the line counting stuff if -X is set seems reasonable. I will look into
that and see if there are any issues with it.
--Mark
On 8/15/2018 2:57 PM, Linus Torvalds wrote:
On Wed, Aug 15, 2018 at 2:29 PM Ævar Arnfjörð Bjarmason
<avarab@xxxxxxxxx> wrote:
Downloading & trying versions of it locally reveals that it's as of
version 520, not 530. The last version before 520 is 487. Presumably
it's covered by this item in the changelog:
Don't output terminal init sequence if using -F and file fits on one
screen[1]
Side note: that's sad, because we already use X in the default exactly
for that reason.
So apparently "less" was broken for us to fix something that we
already had long solved. The code basically tried to do "automatic X
when F is set".
And all that line_count stuff (which is what breaks) is pointless when
-X is already given.
That does give a possible fix: just stop doing the line_count thing if
no_init is set.
So "-F" would continue to be broken, but "-FX" would work.
Something like the attached patch, perhaps?
Linus