Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Don't score whitespace matches

Antonio Scandurraa69461dba2e8
diff --git a/crates/ai/src/diff.rs b/crates/ai/src/diff.rs
index 0f4f3286020..3ba0d005e77 100644
--- a/crates/ai/src/diff.rs
+++ b/crates/ai/src/diff.rs
@@ -107,7 +107,11 @@ impl Diff {
let insertion_score = self.scores.get(i, j - 1) + Self::INSERTION_SCORE;
let deletion_score = self.scores.get(i - 1, j) + Self::DELETION_SCORE;
let equality_score = if self.old[i - 1] == self.new[j - 1] {
- self.scores.get(i - 1, j - 1) + Self::EQUALITY_SCORE
+ if self.old[i - 1] == ' ' {
+ self.scores.get(i - 1, j - 1)
+ } else {
+ self.scores.get(i - 1, j - 1) + Self::EQUALITY_SCORE
+ }
} else {
isize::MIN
};