mirror of
https://github.com/zellij-org/zellij.git
synced 2024-11-26 22:15:19 +03:00
Merge pull request #626 from sagittarius-a/feature/scroll-mode-restore-on-sigint
feat(scroll): Restore scroll position on SIGINT
This commit is contained in:
commit
21f8d6e915
@ -127,6 +127,12 @@ fn route_action(
|
||||
.send_to_screen(ScreenInstruction::ScrollDownAt(point))
|
||||
.unwrap();
|
||||
}
|
||||
Action::ScrollToBottom => {
|
||||
session
|
||||
.senders
|
||||
.send_to_screen(ScreenInstruction::ScrollToBottom)
|
||||
.unwrap();
|
||||
}
|
||||
Action::PageScrollUp => {
|
||||
session
|
||||
.senders
|
||||
|
@ -50,6 +50,7 @@ pub(crate) enum ScreenInstruction {
|
||||
ScrollUpAt(Position),
|
||||
ScrollDown,
|
||||
ScrollDownAt(Position),
|
||||
ScrollToBottom,
|
||||
PageScrollUp,
|
||||
PageScrollDown,
|
||||
ClearScroll,
|
||||
@ -103,6 +104,7 @@ impl From<&ScreenInstruction> for ScreenContext {
|
||||
ScreenInstruction::Exit => ScreenContext::Exit,
|
||||
ScreenInstruction::ScrollUp => ScreenContext::ScrollUp,
|
||||
ScreenInstruction::ScrollDown => ScreenContext::ScrollDown,
|
||||
ScreenInstruction::ScrollToBottom => ScreenContext::ScrollToBottom,
|
||||
ScreenInstruction::PageScrollUp => ScreenContext::PageScrollUp,
|
||||
ScreenInstruction::PageScrollDown => ScreenContext::PageScrollDown,
|
||||
ScreenInstruction::ClearScroll => ScreenContext::ClearScroll,
|
||||
@ -569,6 +571,12 @@ pub(crate) fn screen_thread_main(
|
||||
.unwrap()
|
||||
.scroll_terminal_down(&point, 3);
|
||||
}
|
||||
ScreenInstruction::ScrollToBottom => {
|
||||
screen
|
||||
.get_active_tab_mut()
|
||||
.unwrap()
|
||||
.scroll_active_terminal_to_bottom();
|
||||
}
|
||||
ScreenInstruction::PageScrollUp => {
|
||||
screen
|
||||
.get_active_tab_mut()
|
||||
|
@ -2280,6 +2280,16 @@ impl Tab {
|
||||
self.render();
|
||||
}
|
||||
}
|
||||
pub fn scroll_active_terminal_to_bottom(&mut self) {
|
||||
if let Some(active_terminal_id) = self.get_active_terminal_id() {
|
||||
let active_terminal = self
|
||||
.panes
|
||||
.get_mut(&PaneId::Terminal(active_terminal_id))
|
||||
.unwrap();
|
||||
active_terminal.clear_scroll();
|
||||
self.render();
|
||||
}
|
||||
}
|
||||
pub fn clear_active_terminal_scroll(&mut self) {
|
||||
if let Some(active_terminal_id) = self.get_active_terminal_id() {
|
||||
let active_terminal = self
|
||||
|
@ -178,6 +178,8 @@ keybinds:
|
||||
key: [Ctrl: 'p',]
|
||||
- action: [SwitchToMode: Session,]
|
||||
key: [Ctrl: 'o',]
|
||||
- action: [ScrollToBottom, SwitchToMode: Normal,]
|
||||
key: [Ctrl: 'c',]
|
||||
- action: [Quit,]
|
||||
key: [Ctrl: 'q',]
|
||||
- action: [ScrollDown,]
|
||||
|
@ -202,6 +202,7 @@ pub enum ScreenContext {
|
||||
ScrollUpAt,
|
||||
ScrollDown,
|
||||
ScrollDownAt,
|
||||
ScrollToBottom,
|
||||
PageScrollUp,
|
||||
PageScrollDown,
|
||||
ClearScroll,
|
||||
|
@ -48,6 +48,8 @@ pub enum Action {
|
||||
ScrollDown,
|
||||
/// Scroll down at point
|
||||
ScrollDownAt(Position),
|
||||
/// Scroll down to bottom in focus pane.
|
||||
ScrollToBottom,
|
||||
/// Scroll up one page in focus pane.
|
||||
PageScrollUp,
|
||||
/// Scroll down one page in focus pane.
|
||||
|
Loading…
Reference in New Issue
Block a user