editor: Newtype WrapRow (#41843)

Makes a better distinction between `WrapRow` and `BlockRow`

Release Notes:

- N/A *or* Added/Fixed/Improved ...
This commit is contained in:
Lukas Wirth
2025-11-04 08:48:38 +00:00
committed by GitHub
parent 4002b32ad4
commit 3e7b8efb98
6 changed files with 484 additions and 332 deletions
+12 -8
View File
@@ -496,22 +496,26 @@ pub struct Edit<D> {
pub old: Range<D>,
pub new: Range<D>,
}
impl<D> Edit<D>
where
D: Sub<D, Output = D> + PartialEq + Copy,
D: PartialEq,
{
pub fn old_len(&self) -> D {
pub fn is_empty(&self) -> bool {
self.old.start == self.old.end && self.new.start == self.new.end
}
}
impl<D, DDelta> Edit<D>
where
D: Sub<D, Output = DDelta> + Copy,
{
pub fn old_len(&self) -> DDelta {
self.old.end - self.old.start
}
pub fn new_len(&self) -> D {
pub fn new_len(&self) -> DDelta {
self.new.end - self.new.start
}
pub fn is_empty(&self) -> bool {
self.old.start == self.old.end && self.new.start == self.new.end
}
}
impl<D1, D2> Edit<(D1, D2)> {