self.pos = FilePosition::Fine(item, line);
self.ensure_enough_rendered();
}
+
+ fn goto_top(&mut self) {
+ self.pos = FilePosition::Fine(self.contents.first_index(), 0);
+ let overshoot = self.ensure_enough_rendered();
+ // Clip position at top of file
+ if overshoot > 0 {
+ self.move_down(overshoot);
+ }
+ }
+
+ fn goto_bottom(&mut self) {
+ let (w, _h) = self.last_size.expect("goto_bottom before resize");
+ let item = self.contents.last_index();
+ let line = self.ensure_item_rendered(item, w).len();
+ self.pos = FilePosition::Fine(item, line);
+ self.ensure_enough_rendered();
+ }
}
impl ActivityState for FeedFile {
self.move_down(max(1, h - min(h, 3)));
LogicalAction::Nothing
},
+ Pr('0') | Home => {
+ self.goto_top();
+ LogicalAction::Nothing
+ }
+ Pr('z') | Pr('Z') | End => {
+ self.goto_bottom();
+ LogicalAction::Nothing
+ }
_ => LogicalAction::Nothing,
}
}