};
}
+ fn clip_pos_within_item(&mut self) {
+ let (w, _h) = self.last_size.expect(
+ "clip_pos_within_item before setting pos");
+ // If something has just changed the sizes of rendered items,
+ // we need to make sure self.pos doesn't specify a line
+ // position outside the current item.
+ let nlines = self.ensure_item_rendered(self.pos.item, w).len();
+ if self.pos.width.is_some() {
+ self.pos.line = min(self.pos.line, nlines);
+ }
+ }
+
fn fix_overshoot_at_top(&mut self) {
// If an attempt to move up the document left us with no line
// to display at the top of the screen, move down again to fix
}
self.contents.update_items(client);
+ self.clip_pos_within_item();
self.fix_overshoot_at_top(); // in case the extender vanished
Ok(())
}
self.update_pos_for_size(w, h);
self.fix_overshoot_at_top();
}
+ self.clip_pos_within_item();
self.ensure_enough_rendered();
self.after_setting_pos();
}