mode/document: Add scroll-half-page-{up,down} (C-d/C-u in vi-normal) - #3718
Open
danrasmuson wants to merge 1 commit into
Open
mode/document: Add scroll-half-page-{up,down} (C-d/C-u in vi-normal)#3718danrasmuson wants to merge 1 commit into
danrasmuson wants to merge 1 commit into
Conversation
Vim users expect C-d and C-u to scroll by half a viewport. Nyxt
already ships scroll-page-{up,down} and scroll-to-{top,bottom},
but no half-page variant, so the vi-normal keyscheme leaves C-d
and C-u unbound.
Add scroll-half-page-down and scroll-half-page-up as small wrappers
around window.scrollBy(0, ±innerHeight/2), and bind them to C-d /
C-u in the document-mode vi-normal keyscheme alongside the existing
scroll-page-{up,down} bindings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add
scroll-half-page-downandscroll-half-page-upcommands andbind them to
C-d/C-uin thedocument-modevi-normalkeyscheme.Vim users expect
C-d/C-uto scroll by half a viewport. Nyxtalready ships
scroll-page-{up,down}(bound toC-f/C-b,space/shift-space, etc.) andscroll-to-{top,bottom}(gg/G), but no half-page variant — so thevi-normalkeyschemecurrently leaves
C-dandC-uunbound and they fall through tothe renderer.
The new commands are tiny wrappers around
window.scrollBy(0, ±innerHeight/2), matching the style of theexisting
scroll-page-{up,down}. They are bound alongside theexisting page-scroll bindings in
vi-normal;cuaandemacskeyschemes are intentionally left unchanged since
C-d/C-uhave meanings there (e.g. Emacs
C-d= delete-char).Fixes # (no existing issue — happy to file one if preferred)
Checklist:
couldn't find a CHANGELOG file in the repo; happy to add a
release-notes entry if you point me at the right location.)
via their docstrings; no manual entries reference the existing
scroll commands by name.)
(asdf:test-system :nyxt/<renderer>))one-liners structurally identical to the existing
scroll-page-{up,down}and aren't covered by automated tests.)