aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorJames Campos <james.r.campos@gmail.com>2020-07-29 13:31:26 -0700
committerJames Campos <james.r.campos@gmail.com>2020-07-29 13:31:26 -0700
commit39f0f4cd8ace36b1dfe4ab3c1eb84b4575907c15 (patch)
tree0fdd0ab65f980ad844f0909420522f2796b021d1 /src/main.rs
parente933b8483e7c2ecbd834a43834d68e4af07291e2 (diff)
downloadbk-39f0f4cd8ace36b1dfe4ab3c1eb84b4575907c15.tar.gz
internal
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/main.rs b/src/main.rs
index fc761fb..f427011 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -336,28 +336,18 @@ impl View for Page {
bk.mark('\'');
bk.line = 0;
}
- KeyCode::Char('d') => {
- bk.scroll_down(bk.rows / 2);
- }
- KeyCode::Char('u') => {
- bk.scroll_up(bk.rows / 2);
- }
- KeyCode::Up | KeyCode::Char('k') => {
- bk.scroll_up(3);
- }
+ KeyCode::Char('d') => bk.scroll_down(bk.rows / 2),
+ KeyCode::Char('u') => bk.scroll_up(bk.rows / 2),
+ KeyCode::Up | KeyCode::Char('k') => bk.scroll_up(3),
KeyCode::Left | KeyCode::PageUp | KeyCode::Char('b') | KeyCode::Char('h') => {
bk.scroll_up(bk.rows);
}
- KeyCode::Down | KeyCode::Char('j') => {
- bk.scroll_down(3);
- }
+ KeyCode::Down | KeyCode::Char('j') => bk.scroll_down(3),
KeyCode::Right
| KeyCode::PageDown
| KeyCode::Char('f')
| KeyCode::Char('l')
- | KeyCode::Char(' ') => {
- bk.scroll_down(bk.rows);
- }
+ | KeyCode::Char(' ') => bk.scroll_down(bk.rows),
KeyCode::Char('[') => bk.prev_chapter(),
KeyCode::Char(']') => bk.next_chapter(),
_ => (),
@@ -651,7 +641,7 @@ impl Bk<'_> {
if self.line > 0 {
self.line = self.line.saturating_sub(n);
} else if self.chapter > 0 {
- self.prev_chapter();
+ self.chapter -= 1;
self.line = self.chap().lines.len().saturating_sub(self.rows);
}
}