mirror of https://github.com/helix-editor/helix
Revert "Add filter_format field for Column in pickers"
This reverts commit 9206f0a876
.
pull/13912/head
parent
9206f0a876
commit
7c934855fc
|
@ -281,16 +281,6 @@ fn diag_picker(
|
||||||
} else {
|
} else {
|
||||||
Default::default()
|
Default::default()
|
||||||
}
|
}
|
||||||
})
|
|
||||||
.with_filter_format(|item: &PickerDiagnostic, _| {
|
|
||||||
if let Some(path) = item.location.uri.as_path() {
|
|
||||||
path::get_relative_path(path)
|
|
||||||
.to_string_lossy()
|
|
||||||
.to_string()
|
|
||||||
.into()
|
|
||||||
} else {
|
|
||||||
Default::default()
|
|
||||||
}
|
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
primary_column += 1;
|
primary_column += 1;
|
||||||
|
|
|
@ -137,7 +137,7 @@ fn inject_nucleo_item<T, D>(
|
||||||
) {
|
) {
|
||||||
injector.push(item, |item, dst| {
|
injector.push(item, |item, dst| {
|
||||||
for (column, text) in columns.iter().filter(|column| column.filter).zip(dst) {
|
for (column, text) in columns.iter().filter(|column| column.filter).zip(dst) {
|
||||||
*text = column.format_filter_text(item, editor_data).into()
|
*text = column.format_text(item, editor_data).into()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,6 @@ type ColumnFormatFn<T, D> = for<'a> fn(&'a T, &'a D) -> Cell<'a>;
|
||||||
pub struct Column<T, D> {
|
pub struct Column<T, D> {
|
||||||
name: Arc<str>,
|
name: Arc<str>,
|
||||||
format: ColumnFormatFn<T, D>,
|
format: ColumnFormatFn<T, D>,
|
||||||
filter_format: ColumnFormatFn<T, D>,
|
|
||||||
/// Whether the column should be passed to nucleo for matching and filtering.
|
/// Whether the column should be passed to nucleo for matching and filtering.
|
||||||
/// `DynamicPicker` uses this so that the dynamic column (for example regex in
|
/// `DynamicPicker` uses this so that the dynamic column (for example regex in
|
||||||
/// global search) is not used for filtering twice.
|
/// global search) is not used for filtering twice.
|
||||||
|
@ -202,7 +201,6 @@ impl<T, D> Column<T, D> {
|
||||||
Self {
|
Self {
|
||||||
name: name.into(),
|
name: name.into(),
|
||||||
format,
|
format,
|
||||||
filter_format: format,
|
|
||||||
filter: true,
|
filter: true,
|
||||||
hidden: false,
|
hidden: false,
|
||||||
}
|
}
|
||||||
|
@ -215,7 +213,6 @@ impl<T, D> Column<T, D> {
|
||||||
Self {
|
Self {
|
||||||
name: name.into(),
|
name: name.into(),
|
||||||
format,
|
format,
|
||||||
filter_format: format,
|
|
||||||
filter: false,
|
filter: false,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
}
|
}
|
||||||
|
@ -226,18 +223,12 @@ impl<T, D> Column<T, D> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_filter_format(mut self, format_fn: ColumnFormatFn<T, D>) -> Self {
|
|
||||||
self.filter_format = format_fn;
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
fn format<'a>(&self, item: &'a T, data: &'a D) -> Cell<'a> {
|
fn format<'a>(&self, item: &'a T, data: &'a D) -> Cell<'a> {
|
||||||
(self.format)(item, data)
|
(self.format)(item, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn format_filter_text<'a>(&self, item: &'a T, data: &'a D) -> Cow<'a, str> {
|
fn format_text<'a>(&self, item: &'a T, data: &'a D) -> Cow<'a, str> {
|
||||||
let cell = (self.filter_format)(item, data);
|
let text: String = self.format(item, data).content.into();
|
||||||
let text: String = cell.content.into();
|
|
||||||
text.into()
|
text.into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue