-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature request: option to heed formfeed (control-L) as forcing a new page #496
Comments
P.S. If you (or anyone) has any pointers on how I might go about this, with a little guidance, I'd probably be up for trying to build a patch. I tried looking through the codebase a little, and I think I could wrap my head around it with time, but I wasn't quite sure where to start, and got a little overwhelmed. |
I would like that, too. :-)
At least on my system,
I would also think that a new option should be required to activate ending a page on ASCII FF. Perhaps also enable stopping at ASCII FF when the environment variable
With
IETF RFCs numbered less then 8650 use ASCII FF for pagination. It would be great if Also, some old source code, e.g., some files in GNU Inetutils, contain ASCII FF characters. Additionally, support for ending a page on ASCII FF would improve the usefulness of |
I've added a --form-feed option in the post659 branch, change a0d1f5b. The behavior isn't exactly as was proposed here: the ^L is displayed (which I think is useful so the user can tell why the scroll stopped early), and the screen isn't cleared on any forward movement (which I think is more consistent behavior; for example after stopping, If anyone has comments on the behavior, please let me know. |
This does not seem to work as I would have imagined. In fact, I do not see any difference between the following two commands (output in the form of a screenshot, to illustrate what is shown inside an XTerm):
and
This is with the post659 branch:
With
After pressing the spacebar: |
In the current implementation, less never stops scrolling if doing so would leave less than a screenful of data on the screen. Doing so can lead to various weirdnesses, like repainting the screen with
|
Thanks for the explanation, @gwsw! As far as I understand it,
This continues with additional single lines, e.g.:
This works for me as long as the first formfeed comes at the end of a full screen of text. The following looks good to me:
But the following does not, because it continues across the first formfeed:
The combination with This is not what I had in mind, and it does not work as well for reading IETF RFCs as using I do hope that @lindes also finds the time to look at this and to add a comment. Thanks for looking into this! I really appreciate that you invested time into this issue and worked on a solution that fits into |
Well, more work could possibly be done to make it work more like what you were expecting. When I ran across the issues caused by displaying a partial screen I fixed them by just not allowing a partial screen to be displayed. Possibly something better could be done. If you want to see the issues, you can apply this patch. You'll see that in your examples it does pause after each form feed as you want, but other things don't work well. For example, press
|
Thanks for the explanation and the diff! I can see the problems with pressing |
Hi there. Thank you for your continued work over the decades on less! Neat to see that it seems to be the same original author still actively maintaining it. I've been using less for several of those decades, now, and appreciate having it around. :)
Anyway, I was wondering:
Would it be possible to get less to treat
^L
(aka formfeed,\f
, ASCII FF, etc.) as a signal of wanting a new page of output?Your old friend
more
does "pause" on seeing this character, though that fails to get the niceless
behavior of clearing the screen when about to display a page. IMHO, it'd be nice to have this pause option in less as well, where it would behave more or less similarly to how it behaves when displaying the next of multiple specified input files.I don't imagine it would be desirable to make this the default behavior, because it might surprise a lot of folks, so, the request here is to add a command-line option (
-f
is taken, but-l
seems to be available? And I might propose--form-feed
as the long option name, though I'm open to whatever makes sense to you), and when that option is specified, either on the command line or in one's$LESS
, then it behaves as I'm suggesting.Also, I'm thinking that unlike more, it would make sense for less to not print anything related to the
^L
when this option is on. Just pause and then, upon spacebar, start a new screen page of display. I'm not entirely sure what would make sense as far as backwards scrolling from there. Maybecontrol-B
would just skip you back to the last screen page of the prior section, andk
would actually cause the^L
to display after all, and treat it as though it was an unbroken section of text, at least as long as that^L
is on the screen (after which, hitting space again might get you back to the requested behavior).Hopefully this request makes sense and might be reasonable to accommodate. I know I'd appreciate having this functionality, and while it's certainly possible it's a rare desire, it seems I'm not the only one to have it: I came across a stackoverflow (well, superuser stackexchange) question asking for the same sort of thing.
Thanks again!
The text was updated successfully, but these errors were encountered: