-
Notifications
You must be signed in to change notification settings - Fork 11
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
Tweaks for less compatibility #14
Conversation
3491a95
to
1d04efe
Compare
I really don't like The other stuff is fine. I wasn't aiming for less/vim compatibility, but I understand some people have muscle memory for these things. |
I think it depends on whether the alternate screen is used. When it's not used it seems cleaner not having the "~" left on screen at exit. I'm used to the |
Emulates `less -F -X`. Stream the output immediately to the terminal before entering the full screen mode. Error and progress are rendered after output so it looks visually similar to the full screen UI. The streaming rendering mode (`InterfaceMode::Hybrid`) can be used standalone without entering full screen (`InterfaceMode::Cat`) to emulate buck-build-style output. The 2-second delay "all or nothing" rendering is preserved as `InterfaceMode::Delayed`.
Add flags `--delayed (-D)`, `--no-alternate (-X)` for the new InterfaceMode config. The old flag `--force` was removed. It can be expressed by `-D 0`. `sp -X` matches `less -X -F`. `sp -D 9999` roughly matches `less -F`. `sp -D 0` matches `less` without `-X` or `-F`. `sp` without arguments works like `sp -D 2`, preserving the old behavior.
This makes the code shorter.
Add key bindings that are defined consistently in both vim and less. Including: - j, k: move down or up, by a line - Ctrl+D, Ctrl+U: move down or up, by half a screen - Ctrl+F, Ctrl+B: move down or up, by a screen - g, G: move to the beginning or the end. - N: move to the previous match (line match in sp). I didn't find a good editor for `help.txt` so it is left unchanged for now.
By default, allow scrolling past EOF. If `SP_SCROLL_PAST_EOF` is set to `0`, disallow scrolling past EOF, which matches vim or less' user expectation.
1d04efe
to
d09c5b2
Compare
I made it a config option that can be set via (This is now based on #13, so I don't need to rebase back and forth) |
Looks good. I'll merge after #13 for simplicity. |
Some tweaks to make sp more familiar to
less
users.