Only in /var/lib/copr-rpmbuild/results/ripgrep-edit/upstream-unpacked/Source0/ripgrep-edit-0.3.12: .distro diff -U2 -r /var/lib/copr-rpmbuild/results/ripgrep-edit/upstream-unpacked/Source0/ripgrep-edit-0.3.12/Cargo.toml /var/lib/copr-rpmbuild/results/ripgrep-edit/srpm-unpacked/ripgrep-edit-0.3.12.tar.gz-extract/ripgrep-edit-0.3.12/Cargo.toml --- /var/lib/copr-rpmbuild/results/ripgrep-edit/upstream-unpacked/Source0/ripgrep-edit-0.3.12/Cargo.toml 2026-04-27 14:04:20.000000000 +0000 +++ /var/lib/copr-rpmbuild/results/ripgrep-edit/srpm-unpacked/ripgrep-edit-0.3.12.tar.gz-extract/ripgrep-edit-0.3.12/Cargo.toml 2026-05-08 01:22:02.000000000 +0000 @@ -13,9 +13,13 @@ clap = { version = "4.5", features = ["derive"] } anyhow = "1.0" -textdistance = "1.1" either = "1.15" ctrlc = { version = "3.5", features = ["termination"] } rayon = "1" num_cpus = "1" +triple_accel = { version = "0.4", optional = true } +textdistance = { version = "1.1", optional = true } + +[features] +default = ["triple_accel"] [[bin]] @@ -26,2 +30,6 @@ clap_mangen = "0.2" clap = { version = "4.5", features = ["derive"] } + +[dev-dependencies] +assert_cmd = "2.2" +predicates = "3.1" diff -U2 -r /var/lib/copr-rpmbuild/results/ripgrep-edit/upstream-unpacked/Source0/ripgrep-edit-0.3.12/emacs/rg-edit.el /var/lib/copr-rpmbuild/results/ripgrep-edit/srpm-unpacked/ripgrep-edit-0.3.12.tar.gz-extract/ripgrep-edit-0.3.12/emacs/rg-edit.el --- /var/lib/copr-rpmbuild/results/ripgrep-edit/upstream-unpacked/Source0/ripgrep-edit-0.3.12/emacs/rg-edit.el 2026-04-27 14:04:20.000000000 +0000 +++ /var/lib/copr-rpmbuild/results/ripgrep-edit/srpm-unpacked/ripgrep-edit-0.3.12.tar.gz-extract/ripgrep-edit-0.3.12/emacs/rg-edit.el 2026-05-08 01:22:02.000000000 +0000 @@ -45,5 +45,5 @@ :group 'rg-edit) -(defcustom rg-edit-prefill-extra-args "--multiline --multiline-dotall --smart-case" +(defcustom rg-edit-prefill-extra-args "-U --multiline-dotall --smart-case" "Prefill the rg-edit commands extra-args parameter with this value. These extra arguments are used only if the extra-args parameter is otherwise nil." @@ -116,5 +116,5 @@ "--output-size-limit=100m" (shell-quote-argument dir-name) - (split-string-shell-command extra-args)))) + (split-string-shell-command (string-trim extra-args))))) (defun rg-edit--get-path (path buffer-file) diff -U2 -r /var/lib/copr-rpmbuild/results/ripgrep-edit/upstream-unpacked/Source0/ripgrep-edit-0.3.12/src/gbnf.rs /var/lib/copr-rpmbuild/results/ripgrep-edit/srpm-unpacked/ripgrep-edit-0.3.12.tar.gz-extract/ripgrep-edit-0.3.12/src/gbnf.rs --- /var/lib/copr-rpmbuild/results/ripgrep-edit/upstream-unpacked/Source0/ripgrep-edit-0.3.12/src/gbnf.rs 2026-04-27 14:04:20.000000000 +0000 +++ /var/lib/copr-rpmbuild/results/ripgrep-edit/srpm-unpacked/ripgrep-edit-0.3.12.tar.gz-extract/ripgrep-edit-0.3.12/src/gbnf.rs 2026-05-08 01:22:02.000000000 +0000 @@ -6,5 +6,4 @@ use std::fs::File; use std::io::Write; -use textdistance::Algorithm; use crate::Args; @@ -136,4 +135,20 @@ } +fn compute_distance(a: &str, b: &str) -> f64 { + #[cfg(feature = "triple_accel")] + { + let max_len = a.len().max(b.len()); + if max_len == 0 { + return 0.0; + } + let dist = triple_accel::rdamerau(a.as_bytes(), b.as_bytes()) as f64; + dist / max_len as f64 + } + #[cfg(not(feature = "triple_accel"))] + { + textdistance::nstr::damerau_levenshtein_restricted(a, b) + } +} + pub fn find_distant_control_line<'a>( lines: &'a [String], @@ -153,5 +168,4 @@ .collect() }; - let damerau_levenshtein = textdistance::DamerauLevenshtein::default(); let mut max_dist = 0.0; let mut max_line: Option<&String> = None; @@ -180,5 +194,6 @@ Some(dist) => *dist, None => { - let dist = damerau_levenshtein.for_str(control_line, line).nval(); + let dist = compute_distance(control_line, line); + //println!("{}\n{}\n{}\n", dist, control_line, line); seen.insert(key, dist); dist diff -U2 -r /var/lib/copr-rpmbuild/results/ripgrep-edit/upstream-unpacked/Source0/ripgrep-edit-0.3.12/src/main.rs /var/lib/copr-rpmbuild/results/ripgrep-edit/srpm-unpacked/ripgrep-edit-0.3.12.tar.gz-extract/ripgrep-edit-0.3.12/src/main.rs --- /var/lib/copr-rpmbuild/results/ripgrep-edit/upstream-unpacked/Source0/ripgrep-edit-0.3.12/src/main.rs 2026-04-27 14:04:20.000000000 +0000 +++ /var/lib/copr-rpmbuild/results/ripgrep-edit/srpm-unpacked/ripgrep-edit-0.3.12.tar.gz-extract/ripgrep-edit-0.3.12/src/main.rs 2026-05-08 01:22:02.000000000 +0000 @@ -806,34 +806,23 @@ #[test] fn test_rg_edit_search() { - let output = std::process::Command::new("cargo") - .args(&[ - "run", - "--", - "--regexp", - "context_separator", - "src", - "--editor", - "cat", - "--context=1", - "--filename-prefix", - "-- TEST: ", - ]) - .output() - .expect("Failed to execute rg-edit"); + use assert_cmd::Command; - let output_str = String::from_utf8_lossy(&output.stdout); - let error_str = String::from_utf8_lossy(&output.stderr); + let mut cmd = Command::cargo_bin(env!("CARGO_BIN_NAME")).unwrap(); + cmd.arg("--regexp") + .arg("context_separator") + .arg("src") + .arg("--editor") + .arg("cat") + .arg("--context") + .arg("1") + .arg("--filename-prefix") + .arg("-- TEST: "); - // Ensure rg-edit ran successfully - assert!( - output.status.success(), - "Command failed with: {}", - error_str - ); - - // Check that the output contains the expected lines - assert!(output_str.contains("src/main.rs")); - assert!(output_str.contains("context_separa")); - assert!(error_str.contains("File was not modified")); + let assert = cmd.assert(); + assert + .success() + .stdout(predicates::str::contains("src/main.rs")) + .stdout(predicates::str::contains("context_separa")) + .stderr(predicates::str::contains("File was not modified")); } }