editor: Shrink size of Inlay slightly (#39089)
And some other smaller cleanup things I noticed while reading through some stuff Release Notes: - N/A *or* Added/Fixed/Improved ...
This commit is contained in:
+10
-13
@@ -62,26 +62,23 @@ impl Anchor {
|
||||
}
|
||||
|
||||
pub fn bias(&self, bias: Bias, buffer: &BufferSnapshot) -> Anchor {
|
||||
if bias == Bias::Left {
|
||||
self.bias_left(buffer)
|
||||
} else {
|
||||
self.bias_right(buffer)
|
||||
match bias {
|
||||
Bias::Left => self.bias_left(buffer),
|
||||
Bias::Right => self.bias_right(buffer),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn bias_left(&self, buffer: &BufferSnapshot) -> Anchor {
|
||||
if self.bias == Bias::Left {
|
||||
*self
|
||||
} else {
|
||||
buffer.anchor_before(self)
|
||||
match self.bias {
|
||||
Bias::Left => *self,
|
||||
Bias::Right => buffer.anchor_before(self),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn bias_right(&self, buffer: &BufferSnapshot) -> Anchor {
|
||||
if self.bias == Bias::Right {
|
||||
*self
|
||||
} else {
|
||||
buffer.anchor_after(self)
|
||||
match self.bias {
|
||||
Bias::Left => buffer.anchor_after(self),
|
||||
Bias::Right => *self,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +93,7 @@ impl Anchor {
|
||||
pub fn is_valid(&self, buffer: &BufferSnapshot) -> bool {
|
||||
if *self == Anchor::MIN || *self == Anchor::MAX {
|
||||
true
|
||||
} else if self.buffer_id != Some(buffer.remote_id) {
|
||||
} else if self.buffer_id.is_none_or(|id| id != buffer.remote_id) {
|
||||
false
|
||||
} else {
|
||||
let Some(fragment_id) = buffer.try_fragment_id_for_anchor(self) else {
|
||||
|
||||
Reference in New Issue
Block a user