diff --git a/src/algos/fzf/parser.rs b/src/algos/fzf/parser.rs index 33742f8..96815ff 100644 --- a/src/algos/fzf/parser.rs +++ b/src/algos/fzf/parser.rs @@ -26,6 +26,13 @@ impl Default for FzfParser { } } +impl core::fmt::Debug for FzfParser { + #[inline] + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + f.debug_struct("FzfParser").finish_non_exhaustive() + } +} + impl FzfParser { /// TODO: docs #[inline] diff --git a/src/algos/fzf/scheme.rs b/src/algos/fzf/scheme.rs index 6dd7efc..093056a 100644 --- a/src/algos/fzf/scheme.rs +++ b/src/algos/fzf/scheme.rs @@ -24,6 +24,22 @@ impl FzfScheme { Self::History => HISTORY, } } + + /// TODO: docs + #[inline] + pub(super) fn from_inner(scheme: &Scheme) -> Option { + if scheme.bonus_boundary_white == DEFAULT.bonus_boundary_white { + Some(Self::Default) + } else if scheme.bonus_boundary_white == PATH.bonus_boundary_white { + if scheme.initial_char_class == CharClass::Delimiter { + Some(Self::Path) + } else { + Some(Self::History) + } + } else { + None + } + } } /// TODO: docs diff --git a/src/algos/fzf/v1.rs b/src/algos/fzf/v1.rs index a7d3f4d..08f10e4 100644 --- a/src/algos/fzf/v1.rs +++ b/src/algos/fzf/v1.rs @@ -17,6 +17,17 @@ pub struct FzfV1 { with_matched_ranges: bool, } +impl core::fmt::Debug for FzfV1 { + #[inline] + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + f.debug_struct("FzfV2") + .field("case_sensitivity", &self.case_sensitivity) + .field("matched_ranges", &self.with_matched_ranges) + .field("scheme", &FzfScheme::from_inner(&self.scheme).unwrap()) + .finish_non_exhaustive() + } +} + impl FzfV1 { /// TODO: docs #[inline] diff --git a/src/algos/fzf/v2.rs b/src/algos/fzf/v2.rs index 8fc9ea0..cfd2048 100644 --- a/src/algos/fzf/v2.rs +++ b/src/algos/fzf/v2.rs @@ -18,6 +18,17 @@ pub struct FzfV2 { with_matched_ranges: bool, } +impl core::fmt::Debug for FzfV2 { + #[inline] + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + f.debug_struct("FzfV2") + .field("case_sensitivity", &self.case_sensitivity) + .field("matched_ranges", &self.with_matched_ranges) + .field("scheme", &FzfScheme::from_inner(&self.scheme).unwrap()) + .finish_non_exhaustive() + } +} + impl FzfV2 { /// TODO: docs #[inline]