Add keyboard shortcuts for scrolling in terminal (#13508)
Fixes #4917, #12231 Release Notes: - Added keyboard shortcuts for scrolling in terminal ([4917](https://github.com/zed-industries/zed/issues/4917), [12231](https://github.com/zed-industries/zed/issues/12231))
This commit is contained in:
parent
61bbb3539a
commit
d5fbf75ccf
4 changed files with 95 additions and 4 deletions
|
@ -64,7 +64,19 @@ use crate::mappings::{colors::to_alac_rgb, keys::to_esc_str};
|
|||
|
||||
actions!(
|
||||
terminal,
|
||||
[Clear, Copy, Paste, ShowCharacterPalette, SearchTest,]
|
||||
[
|
||||
Clear,
|
||||
Copy,
|
||||
Paste,
|
||||
ShowCharacterPalette,
|
||||
SearchTest,
|
||||
ScrollLineUp,
|
||||
ScrollLineDown,
|
||||
ScrollPageUp,
|
||||
ScrollPageDown,
|
||||
ScrollToTop,
|
||||
ScrollToBottom,
|
||||
]
|
||||
);
|
||||
|
||||
///Scrolling is unbearably sluggish by default. Alacritty supports a configurable
|
||||
|
@ -982,6 +994,36 @@ impl Terminal {
|
|||
self.events.push_back(InternalEvent::Clear)
|
||||
}
|
||||
|
||||
pub fn scroll_line_up(&mut self) {
|
||||
self.events
|
||||
.push_back(InternalEvent::Scroll(AlacScroll::Delta(1)));
|
||||
}
|
||||
|
||||
pub fn scroll_line_down(&mut self) {
|
||||
self.events
|
||||
.push_back(InternalEvent::Scroll(AlacScroll::Delta(-1)));
|
||||
}
|
||||
|
||||
pub fn scroll_page_up(&mut self) {
|
||||
self.events
|
||||
.push_back(InternalEvent::Scroll(AlacScroll::PageUp));
|
||||
}
|
||||
|
||||
pub fn scroll_page_down(&mut self) {
|
||||
self.events
|
||||
.push_back(InternalEvent::Scroll(AlacScroll::PageDown));
|
||||
}
|
||||
|
||||
pub fn scroll_to_top(&mut self) {
|
||||
self.events
|
||||
.push_back(InternalEvent::Scroll(AlacScroll::Top));
|
||||
}
|
||||
|
||||
pub fn scroll_to_bottom(&mut self) {
|
||||
self.events
|
||||
.push_back(InternalEvent::Scroll(AlacScroll::Bottom));
|
||||
}
|
||||
|
||||
///Resize the terminal and the PTY.
|
||||
pub fn set_size(&mut self, new_size: TerminalSize) {
|
||||
if self.last_content.size != new_size {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue