aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorJames Campos <james.r.campos@gmail.com>2020-11-23 00:35:48 -0800
committerJames Campos <james.r.campos@gmail.com>2020-11-23 00:35:48 -0800
commit2a9bd053196deb7710729bc3541e7d5feb9e4856 (patch)
treed500c8259912989184165ea461d7eaa5fff8dfcf /src/main.rs
parent1df2eb16f974de2dfc31fd1b4937ecbd3f7bc3be (diff)
downloadbk-2a9bd053196deb7710729bc3541e7d5feb9e4856.tar.gz
toc cursor #8
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 0b322c8..1792dfb 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -109,9 +109,9 @@ pub struct Bk<'a> {
max_width: u16,
// view state
view: Option<&'a dyn View>,
+ cursor: usize,
dir: Direction,
meta: Vec<String>,
- nav_top: usize,
query: String,
}
@@ -147,9 +147,9 @@ impl Bk<'_> {
rows: rows as usize,
max_width: args.width,
view: Some(if args.toc { &Nav } else { &Page }),
+ cursor: 0,
dir: Direction::Next,
meta,
- nav_top: 0,
query: String::new(),
};
@@ -180,6 +180,7 @@ impl Bk<'_> {
for (i, line) in view.render(self).iter().enumerate() {
queue!(stdout, cursor::MoveTo(self.pad(), i as u16), Print(line))?;
}
+ queue!(stdout, cursor::MoveTo(self.pad(), self.cursor as u16))?;
stdout.flush().unwrap();
match event::read()? {