diff options
author | root <github@bigly.dog> | 2024-03-22 13:20:25 -0700 |
---|---|---|
committer | root <github@bigly.dog> | 2024-03-22 13:46:51 -0700 |
commit | beb8ac5b17d703cc1c9daf761bf6713491338e95 (patch) | |
tree | 047edd67f6bdea5438794653bf656bf98b6b33be | |
parent | 2db7590757fb8346ef7b0b7fb2de0eb5faace34b (diff) |
fzf
-rw-r--r-- | RELEASE_NOTES.md | 6 | ||||
-rw-r--r-- | src/fzf.rs | 3 | ||||
-rw-r--r-- | src/input.rs | 8 |
3 files changed, 12 insertions, 5 deletions
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index a18e988..4386ea7 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,9 +1,9 @@ ## Good news -v0.4.16 +v0.4.24 -- Added windows +- Fewer dependencies -- Added aarch64 +- More robust signal handling **Released by CI** @@ -58,7 +58,7 @@ pub fn stream_fzf_proc<'a>( "--preview-window=70%:wrap".to_owned(), format!("--bind=enter:{execute}"), format!("--bind=double-click:{execute}"), - format!("--preview={}\x04{{f}}", Mode::PREVIEW), + format!("--preview={}\x04{{+f}}", Mode::PREVIEW), ]; arguments.extend(args); @@ -86,6 +86,7 @@ pub fn stream_fzf_proc<'a>( let stream = BoxStream::from(stream_subproc(cmd, stream)).then(|line| async { match line { Ok(o) => Ok(o), + Err(Fail::BadExit(_, 130)) => Err(Fail::Interrupt), e => { let _ = reset_term().await; e diff --git a/src/input.rs b/src/input.rs index 0545e01..d7f5e58 100644 --- a/src/input.rs +++ b/src/input.rs @@ -27,6 +27,7 @@ pub enum LineIn { Piecewise(PathBuf, HashSet<DiffRange>), } +#[derive(Debug)] struct DiffLine(PathBuf, DiffRange); fn p_line(line: &str) -> Result<DiffLine, Fail> { @@ -108,7 +109,12 @@ async fn stream_patch(patches: &Path) -> Box<dyn Stream<Item = Result<LineIn, Fa let ranges = s.3; s.2 = parsed.0; s.3 = HashSet::new(); - Ok(Some((Some(LineIn::Piecewise(path, ranges)), s))) + s.3.insert(parsed.1); + if ranges.is_empty() { + Ok(Some((None, s))) + } else { + Ok(Some((Some(LineIn::Piecewise(path, ranges)), s))) + } } } } |