diff options
author | Blaž Hrastnik | 2020-12-18 10:24:50 +0000 |
---|---|---|
committer | GitHub | 2020-12-18 10:24:50 +0000 |
commit | 3f0dbfcac878131167953b6f57c923a5bc889e80 (patch) | |
tree | 41b876f9bb067e5f199fe53ecb78eeb57d09719b /helix-view/src | |
parent | b12a6dc8303bbc1b4b08a9abb4668741d154adbd (diff) | |
parent | 25aa45e76c9bec62f36a59768298e1f2ea2678bf (diff) |
Merge pull request #7 from helix-editor/interactive-split-select
File picker/interactive split prompt
Diffstat (limited to 'helix-view/src')
-rw-r--r-- | helix-view/src/document.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index 7c4596ad..323c7bff 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -1,6 +1,6 @@ use anyhow::Error; use std::future::Future; -use std::path::PathBuf; +use std::path::{Path, PathBuf}; use helix_core::{ syntax::LOADER, ChangeSet, Diagnostic, History, Position, Range, Rope, RopeSlice, Selection, @@ -201,6 +201,13 @@ impl Document { &self.state.selection } + pub fn relative_path(&self) -> Option<&Path> { + self.path.as_ref().map(|path| { + path.strip_prefix(std::env::current_dir().unwrap()) + .unwrap_or(path) + }) + } + // pub fn slice<R>(&self, range: R) -> RopeSlice where R: RangeBounds { // self.state.doc.slice // } |