Skip to content

Conversation

@thecoolwinter
Copy link
Contributor

Description

  • Adds support for page up/down keys, including selecting text.
  • Modifies the logic in scrollSelectionToVisible to match macOS precedence. It now:
    • Grabs the "lowest" cursor/selection.
    • Scrolls to the opposite end of the "pivot" for that selection. Eg: if selecting Up after selecting Down, scrolls to the end of the selection while still scrolling Up to follow the moving selection end.

Note that Xcode, Zed, Vim, and Emacs do not move the cursor when using the page up/down keys. Instead they only move the viewport, which is what I've emulated here. VSCode is different, and moves the cursor when using page up/down. However I believe this is actually a bug in VSCode since every other editor I can find uses page up/down as scroll commands rather than cursor ones.

Related Issues

Checklist

  • I read and understood the contributing guide as well as the code of conduct
  • The issues this PR addresses are related to each other
  • My changes generate no new warnings
  • My code builds and runs on my machine
  • My changes are all related to the related issue above
  • I documented my code

Screenshots

Example app, moving around the document using page up/down and extending the selection by adding the shift key.

Screen.Recording.2024-06-15.at.6.27.10.PM.mov

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐞 Page up and page down keys don't do anything

2 participants