Skip to content

Commit

Permalink
Scroll with shift+home,end,pageup,pagedown
Browse files Browse the repository at this point in the history
  • Loading branch information
jackpot51 committed Apr 8, 2024
1 parent 782bce1 commit 770549e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2231,7 +2231,7 @@ impl Application for App {
}
TermEvent::ChildExit(_error_code) => {
//Ignore this for now
},
}
}
}
Message::TermEventTx(term_event_tx) => {
Expand Down
28 changes: 24 additions & 4 deletions src/terminal_box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -608,8 +608,22 @@ where
let escape_code = match named {
Named::Insert => csi("2", "~", mod_no),
Named::Delete => csi("3", "~", mod_no),
Named::PageUp => csi("5", "~", mod_no),
Named::PageDown => csi("6", "~", mod_no),
Named::PageUp => {
if modifiers.shift() {
terminal.scroll(TerminalScroll::PageUp);
None
} else {
csi("5", "~", mod_no)
}
}
Named::PageDown => {
if modifiers.shift() {
terminal.scroll(TerminalScroll::PageDown);
None
} else {
csi("6", "~", mod_no)
}
}
Named::ArrowUp => {
if is_app_cursor {
ss3("A", mod_no)
Expand Down Expand Up @@ -639,14 +653,20 @@ where
}
}
Named::End => {
if is_app_cursor {
if modifiers.shift() {
terminal.scroll(TerminalScroll::Bottom);
None
} else if is_app_cursor {
ss3("F", mod_no)
} else {
csi("F", "", mod_no)
}
}
Named::Home => {
if is_app_cursor {
if modifiers.shift() {
terminal.scroll(TerminalScroll::Top);
None
} else if is_app_cursor {
ss3("H", mod_no)
} else {
csi("H", "", mod_no)
Expand Down

0 comments on commit 770549e

Please sign in to comment.