Improve DisplayPoint Debug impl
This commit is contained in:
parent
e5a00d72f8
commit
f70f4c7729
1 changed files with 12 additions and 3 deletions
|
@ -12,7 +12,7 @@ use gpui::{
|
||||||
Entity, ModelContext, ModelHandle,
|
Entity, ModelContext, ModelHandle,
|
||||||
};
|
};
|
||||||
use language::{Point, Subscription as BufferSubscription};
|
use language::{Point, Subscription as BufferSubscription};
|
||||||
use std::{any::TypeId, ops::Range, sync::Arc};
|
use std::{any::TypeId, fmt::Debug, ops::Range, sync::Arc};
|
||||||
use sum_tree::{Bias, TreeMap};
|
use sum_tree::{Bias, TreeMap};
|
||||||
use tab_map::TabMap;
|
use tab_map::TabMap;
|
||||||
use wrap_map::WrapMap;
|
use wrap_map::WrapMap;
|
||||||
|
@ -414,9 +414,19 @@ impl DisplaySnapshot {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, Default, Eq, Ord, PartialOrd, PartialEq)]
|
#[derive(Copy, Clone, Default, Eq, Ord, PartialOrd, PartialEq)]
|
||||||
pub struct DisplayPoint(BlockPoint);
|
pub struct DisplayPoint(BlockPoint);
|
||||||
|
|
||||||
|
impl Debug for DisplayPoint {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
f.write_fmt(format_args!(
|
||||||
|
"DisplayPoint({}, {})",
|
||||||
|
self.row(),
|
||||||
|
self.column()
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl DisplayPoint {
|
impl DisplayPoint {
|
||||||
pub fn new(row: u32, column: u32) -> Self {
|
pub fn new(row: u32, column: u32) -> Self {
|
||||||
Self(BlockPoint(Point::new(row, column)))
|
Self(BlockPoint(Point::new(row, column)))
|
||||||
|
@ -426,7 +436,6 @@ impl DisplayPoint {
|
||||||
Self::new(0, 0)
|
Self::new(0, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
pub fn is_zero(&self) -> bool {
|
pub fn is_zero(&self) -> bool {
|
||||||
self.0.is_zero()
|
self.0.is_zero()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue