git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: "less -F" is broken

From
MNMark Nudelman <markn@greenwoodsoftware.com>
Date
Aug 16, 2018, 16:50 UTC
Message-ID
<e7fb0ae0-b3e3-d7ad-7f6e-c114ee563d59@greenwoodsoftware.com>
In-Reply-To
<CA+55aFxjUsvhHwQGthGiLr537BGHkd-LECXVv8KzBTMMCo1bKQ@mail.gmail.com>

-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:
Show 29 quoted lines
> On Wed, Aug 15, 2018 at 2:29 PM Ævar Arnfjörð Bjarmason
> <avarab@gmail.com> 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
> 
Previous: Ævar Arnfjörð BjarmasonNext: Linus Torvalds
Message 7 of 9 in “"less -F" is broken”
  1. Linus TorvaldsAug 15, 2018
  2. Stefan BellerAug 15, 2018
  3. Ævar Arnfjörð BjarmasonAug 15, 2018
  4. Linus TorvaldsAug 15, 2018
  5. Linus TorvaldsAug 15, 2018
  6. Ævar Arnfjörð BjarmasonAug 16, 2018
  7. Mark NudelmanAug 16, 2018
  8. Linus TorvaldsAug 16, 2018
  9. Mark NudelmanAug 20, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.