diff options
author | James Campos <james.r.campos@gmail.com> | 2020-11-23 00:35:48 -0800 |
---|---|---|
committer | James Campos <james.r.campos@gmail.com> | 2020-11-23 00:35:48 -0800 |
commit | 2a9bd053196deb7710729bc3541e7d5feb9e4856 (patch) | |
tree | d500c8259912989184165ea461d7eaa5fff8dfcf /src/main.rs | |
parent | 1df2eb16f974de2dfc31fd1b4937ecbd3f7bc3be (diff) | |
download | bk-2a9bd053196deb7710729bc3541e7d5feb9e4856.tar.gz |
toc cursor #8
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 5 |
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()? { |