Re: "less -F" is broken

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/16/2018 10:10 AM, Linus Torvalds wrote:
One option that I didn't try to go for - because I just don't know the
less code base well enough - is to basically make the behavior of '-F'
be something like this:

  - as long as all the lines are short and well-behaved, and we haven't
seen enough lines to fill the screen, act like 'cat' and just feed
them through

  - when you fill the screen (or when you hit some other condition that
makes you go "now I won't exit" - that could be a long line, but maybe
it could also be the user giving keyboard input for a less command?)
you send the init sequence and just redraw the whole screen.

I'm not sure that this would be a very nice user experience. On a terminal where the init sequence opens an alternate screen, some lines from the start of the file would be printed in the main screen, and then the whole file would be viewed in the alternate screen. After exiting less, the user would see his main screen with some lines from the first page of the file displayed and then cut off at a seemingly arbitrary point. Seems like that could be confusing and annoying.


But let's say that that was all the user was interested in, and the
user presses 'q' to quit less. That doesn't work at all - it will wait
for that full ten seconds.

That actually happens even without -F too.

Wouldn't it be good to react to things like searches to highlight
something (and to 'quit' for the 'never mind, alteady got it' case)
even if there isn't enough data to fill the whole screen yet?

that said, ^C works, and this is not new behavior, so I'm just
throwing this out as a "maybe a different approach would fix _both_
the -F behavior _and_ the above traditional issue"?

This issue is, as you say, not related to the -F issue, but arises because less doesn't have a way to be reading a file and simultaneously react to terminal key presses. When I first wrote less, there was no easy way to do this in Unix. Less also runs on other OSes which don't provide this functionality. The best I was able to do was to allow ctrl-C to interrupt the read. Of course in a modern OS that has select() or similar functionality this could be implemented, but I think it would require some largish changes to the architecture. (Or maybe not; I haven't really investigated this in detail.)

BTW, your first message seems to indicate that you didn't find the less project on github. It's at https://github.com/gwsw/less (mentioned in the README). The latest version (v535) has the -F change implemented, but I haven't yet released this for beta testing.

--Mark




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux