pull/8/head
Blaž Hrastnik 4 years ago
parent 3b6c9648f3
commit 8b9b02f08b

@ -27,8 +27,9 @@
- [ ] regex search / select next
- [ ] f / t mappings
- [ ] open_above (O) command
- [ ] = for auto indent line/selection
- [ ] q should only close the view, if all are closed, close the editor
- [x] q should only close the view, if all are closed, close the editor
- [ ] buffers should sit on editor.buffers, view simply refs them

@ -300,10 +300,11 @@ impl Document {
}
pub fn relative_path(&self) -> Option<&Path> {
self.path.as_ref().map(|path| {
path.strip_prefix(std::env::current_dir().unwrap())
.unwrap_or(path)
})
let cwdir = std::env::current_dir().expect("couldn't determine current directory");
self.path
.as_ref()
.map(|path| path.strip_prefix(cwdir).unwrap_or(path))
}
// pub fn slice<R>(&self, range: R) -> RopeSlice where R: RangeBounds {

@ -303,6 +303,27 @@ impl Tree {
// For now that's okay though, since it's unlikely you'll be able to open a large enough
// number of splits to notice.
// current = focus
// let found = loop do {
// node = focus.parent;
// let found = node.next_sibling_of(current)
// if some {
// break found;
// }
// // else
// if node == root {
// return first child of root;
// };
// current = parent;
// }
// }
//
// use found next sibling
// loop do {
// if found = view -> focus = found, return
// if found = container -> found = first child
// }
let iter = self.traverse();
let mut iter = iter.skip_while(|&(key, _view)| key != self.focus);

Loading…
Cancel
Save