Add Cursor::set_position.

Make it possible to move a cursor to a new position.

In the current implementation of Layout and Cursor, this is a trivial
operation, but if we switch to a B-tree based function layout, this
involves navigating the tree.
This commit is contained in:
Jakob Stoklund Olesen
2016-11-04 08:44:01 -07:00
parent 9086c6c8f0
commit 63fc81541e

View File

@@ -381,6 +381,11 @@ impl<'f> Cursor<'f> {
self.pos
}
/// Move the cursor to a new position.
pub fn set_position(&mut self, pos: CursorPosition) {
self.pos = pos;
}
/// Get the EBB corresponding to the current position.
pub fn current_ebb(&self) -> Option<Ebb> {
use self::CursorPosition::*;