From 67f5b7016914e20238a54decb718ac700c09cf5b Mon Sep 17 00:00:00 2001 From: Matt Paras Date: Mon, 9 Jun 2025 07:00:45 -0700 Subject: [PATCH] implement equality for some more types --- helix-view/src/extension.rs | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/helix-view/src/extension.rs b/helix-view/src/extension.rs index e2d77b956..0c9855cc9 100644 --- a/helix-view/src/extension.rs +++ b/helix-view/src/extension.rs @@ -27,7 +27,15 @@ mod steel_implementations { impl steel::gc::unsafe_erased_pointers::CustomReference for Editor {} steel::custom_reference!(Editor); - impl steel::rvals::Custom for Mode {} + impl steel::rvals::Custom for Mode { + fn equality_hint(&self, other: &dyn steel::rvals::CustomType) -> bool { + if let Some(other) = as_underlying_type::(other) { + self == other + } else { + false + } + } + } impl steel::rvals::Custom for Event {} impl Custom for Style { fn fmt(&self) -> Option> { @@ -51,8 +59,24 @@ mod steel_implementations { } } } - impl Custom for crate::graphics::CursorKind {} - impl Custom for DocumentId {} + impl Custom for crate::graphics::CursorKind { + fn equality_hint(&self, other: &dyn steel::rvals::CustomType) -> bool { + if let Some(other) = as_underlying_type::(other) { + self == other + } else { + false + } + } + } + impl Custom for DocumentId { + fn equality_hint(&self, other: &dyn steel::rvals::CustomType) -> bool { + if let Some(other) = as_underlying_type::(other) { + self == other + } else { + false + } + } + } impl Custom for ViewId { fn equality_hint(&self, other: &dyn steel::rvals::CustomType) -> bool { if let Some(other) = as_underlying_type::(other) {