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

Fix Page Up/Down Keys #38

Merged
merged 4 commits into from
Jun 16, 2024
Merged

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

@thecoolwinter thecoolwinter merged commit 9e6d94a into CodeEditApp:main Jun 16, 2024
2 checks passed
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