From 2a9bd053196deb7710729bc3541e7d5feb9e4856 Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 23 Nov 2020 00:35:48 -0800 Subject: toc cursor #8 --- src/main.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/main.rs') 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, - 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()? { -- cgit v1.2.3