summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroot <github@bigly.dog>2024-03-22 13:20:25 -0700
committerroot <github@bigly.dog>2024-03-22 13:46:51 -0700
commitbeb8ac5b17d703cc1c9daf761bf6713491338e95 (patch)
tree047edd67f6bdea5438794653bf656bf98b6b33be
parent2db7590757fb8346ef7b0b7fb2de0eb5faace34b (diff)
fzf
-rw-r--r--RELEASE_NOTES.md6
-rw-r--r--src/fzf.rs3
-rw-r--r--src/input.rs8
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**
diff --git a/src/fzf.rs b/src/fzf.rs
index dce347b..3b523ce 100644
--- a/src/fzf.rs
+++ b/src/fzf.rs
@@ -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)))
+ }
}
}
}