Skip to content
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

Open
lindes opened this issue Apr 6, 2024 · 1 comment

Comments

@lindes
Copy link

lindes commented Apr 6, 2024

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 nice less 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. Maybe control-B would just skip you back to the last screen page of the prior section, and k 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!

@lindes
Copy link
Author

lindes commented Apr 10, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants