Skip to content

mode/document: Add scroll-half-page-{up,down} (C-d/C-u in vi-normal) - #3718

Open
danrasmuson wants to merge 1 commit into
atlas-engineer:masterfrom
danrasmuson:add-scroll-half-page
Open

mode/document: Add scroll-half-page-{up,down} (C-d/C-u in vi-normal)#3718
danrasmuson wants to merge 1 commit into
atlas-engineer:masterfrom
danrasmuson:add-scroll-half-page

Conversation

@danrasmuson

Copy link
Copy Markdown

Description

Add scroll-half-page-down and scroll-half-page-up commands and
bind them to C-d / C-u in the document-mode vi-normal keyscheme.

Vim users expect C-d / C-u to scroll by half a viewport. Nyxt
already ships scroll-page-{up,down} (bound to C-f / C-b,
space / shift-space, etc.) and scroll-to-{top,bottom} (gg /
G), but no half-page variant — so the vi-normal keyscheme
currently leaves C-d and C-u unbound and they fall through to
the renderer.

The new commands are tiny wrappers around
window.scrollBy(0, ±innerHeight/2), matching the style of the
existing scroll-page-{up,down}. They are bound alongside the
existing page-scroll bindings in vi-normal; cua and emacs
keyschemes are intentionally left unchanged since C-d / C-u
have meanings there (e.g. Emacs C-d = delete-char).

Fixes # (no existing issue — happy to file one if preferred)

Checklist:

  • Git branch state is mergable.
  • Changelog is up to date (via a separate commit). (n/a — I
    couldn't find a CHANGELOG file in the repo; happy to add a
    release-notes entry if you point me at the right location.)
  • New dependencies are accounted for. (none)
  • Documentation is up to date. (commands are self-documenting
    via their docstrings; no manual entries reference the existing
    scroll commands by name.)
  • Compilation and tests ((asdf:test-system :nyxt/<renderer>))
    • No new compilation warnings.
    • Tests are sufficient. (no test changes; the new commands are
      one-liners structurally identical to the existing
      scroll-page-{up,down} and aren't covered by automated tests.)

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant