on master help sign in
minor
8b9b02fBlaž Hrastnik
TODO.md+2−1
@@ -27,8 +27,9 @@
27
27
28- [ ] regex search / select next
28- [ ] regex search / select next
29- [ ] f / t mappings
29- [ ] f / t mappings
30+- [ ] open_above (O) command
30- [ ] = for auto indent line/selection
31- [ ] = 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
32- [ ] buffers should sit on editor.buffers, view simply refs them
33- [ ] buffers should sit on editor.buffers, view simply refs them
33
34
34
35
helix-view/src/document.rs+5−4
@@ -300,10 +300,11 @@ impl Document {
300 }
300 }
301
301
302 pub fn relative_path(&self) -> Option<&Path> {
302 pub fn relative_path(&self) -> Option<&Path> {
303+ let cwdir = std::env::current_dir().expect("couldn't determine current directory");
304+
303− self.path.as_ref().map(|path| {
305+ self.path
304− path.strip_prefix(std::env::current_dir().unwrap())
306+ .as_ref()
305− .unwrap_or(path)
307+ .map(|path| path.strip_prefix(cwdir).unwrap_or(path))
306− })
307 }
308 }
308
309
309 // pub fn slice<R>(&self, range: R) -> RopeSlice where R: RangeBounds {
310 // pub fn slice<R>(&self, range: R) -> RopeSlice where R: RangeBounds {
helix-view/src/tree.rs+21
@@ -303,6 +303,27 @@ impl Tree {
303 // For now that's okay though, since it's unlikely you'll be able to open a large enough
303 // For now that's okay though, since it's unlikely you'll be able to open a large enough
304 // number of splits to notice.
304 // number of splits to notice.
305
305
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+
306 let iter = self.traverse();
327 let iter = self.traverse();
307
328
308 let mut iter = iter.skip_while(|&(key, _view)| key != self.focus);
329 let mut iter = iter.skip_while(|&(key, _view)| key != self.focus);