on master help sign in
minor
commit8b9b02f08b5554a4c17e533937c74c1fb80df5f5 authorBlaž Hrastnik <blaz@mxxn.io> dateMon 22 Feb 2021, 12:06 (6 years ago) parent3b6c964
3 files changed+28−5
TODO.md+2−1 helix-view/src/document.rs+5−4 helix-view/src/tree.rs+21
TODO.md+2−1
@@ -27,8 +27,9 @@
2727
2828- [ ] regex search / select next
2929- [ ] f / t mappings
30+- [ ] open_above (O) command
3031- [ ] = for auto indent line/selection
31−- [ ] q should only close the view, if all are closed, close the editor
32+- [x] q should only close the view, if all are closed, close the editor
3233- [ ] buffers should sit on editor.buffers, view simply refs them
3334
3435
helix-view/src/document.rs+5−4
@@ -300,10 +300,11 @@ impl Document {
300300 }
301301
302302 pub fn relative_path(&self) -> Option<&Path> {
303− self.path.as_ref().map(|path| {
304− path.strip_prefix(std::env::current_dir().unwrap())
305− .unwrap_or(path)
306− })
303+ let cwdir = std::env::current_dir().expect("couldn't determine current directory");
304+
305+ self.path
306+ .as_ref()
307+ .map(|path| path.strip_prefix(cwdir).unwrap_or(path))
307308 }
308309
309310 // pub fn slice<R>(&self, range: R) -> RopeSlice where R: RangeBounds {
helix-view/src/tree.rs+21
@@ -303,6 +303,27 @@ impl Tree {
303303 // For now that's okay though, since it's unlikely you'll be able to open a large enough
304304 // number of splits to notice.
305305
306+ // current = focus
307+ // let found = loop do {
308+ // node = focus.parent;
309+ // let found = node.next_sibling_of(current)
310+ // if some {
311+ // break found;
312+ // }
313+ // // else
314+ // if node == root {
315+ // return first child of root;
316+ // };
317+ // current = parent;
318+ // }
319+ // }
320+ //
321+ // use found next sibling
322+ // loop do {
323+ // if found = view -> focus = found, return
324+ // if found = container -> found = first child
325+ // }
326+
306327 let iter = self.traverse();
307328
308329 let mut iter = iter.skip_while(|&(key, _view)| key != self.focus);