editor: Add SelectPageUp/SelectPageDown actions (#13272)

This adds two new actions to `editor`:

- `editor::SelectPageUp`
- `editor::SelectPageDown`

On Linux they're bound by default to `shift-pageup` and
`shift-pagedown`, which matches VS Code and JetBrains.

Release Notes:

- N/A
This commit is contained in:
Thorsten Ball 2024-06-19 17:37:17 +02:00 committed by GitHub
parent cd2533de5a
commit 3d4f275c52
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 41 additions and 8 deletions

View file

@ -330,6 +330,11 @@ impl Editor {
self.scroll_manager.visible_line_count
}
pub fn visible_row_count(&self) -> Option<u32> {
self.visible_line_count()
.map(|line_count| line_count as u32 - 1)
}
pub(crate) fn set_visible_line_count(&mut self, lines: f32, cx: &mut ViewContext<Self>) {
let opened_first_time = self.scroll_manager.visible_line_count.is_none();
self.scroll_manager.visible_line_count = Some(lines);