Skip to content

Commit 817b45f

Browse files
committed
[gui]
Removing fields from multi filters now works field string for multi filter is now cleared
1 parent 0c36e2f commit 817b45f

File tree

3 files changed

+44
-5
lines changed

3 files changed

+44
-5
lines changed

function-grep/src/filter.rs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
use general_filters::{FunctionInImpl, FunctionInLines, FunctionWithParameterRust};
1+
use general_filters::{
2+
FunctionInImpl, FunctionInLines, FunctionWithParameterPython, FunctionWithParameterRust,
3+
};
24
use std::{
35
collections::{hash_map, HashMap},
46
fmt::{self, Display},
@@ -335,10 +337,18 @@ impl Filters<'static> {
335337
.to_string(),
336338
SingleOrMany::Many(Many {
337339
name: "function_with_parameter".to_string(),
338-
filters: HashMap::from([(
339-
FunctionWithParameterRust.supports().0,
340-
&FunctionWithParameterRust as &'static dyn Filter<Supports = Language>,
341-
)]),
340+
filters: HashMap::from([
341+
(
342+
FunctionWithParameterRust.supports().0,
343+
&FunctionWithParameterRust
344+
as &'static dyn Filter<Supports = Language>,
345+
),
346+
(
347+
FunctionWithParameterPython.supports().0,
348+
&FunctionWithParameterPython
349+
as &'static dyn Filter<Supports = Language>,
350+
),
351+
]),
342352
}),
343353
),
344354
]),

function-grep/src/filter/general_filters.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ impl HasFilterInformation for FunctionInImpl {
113113
}
114114

115115
pub struct FunctionWithParameterRust;
116+
pub struct FunctionWithParameterPython;
116117

117118
impl HasFilterInformation for FunctionWithParameterRust {
118119
fn filter_name(&self) -> String {
@@ -139,3 +140,29 @@ impl Filter for FunctionWithParameterRust {
139140
todo!()
140141
}
141142
}
143+
144+
impl HasFilterInformation for FunctionWithParameterPython {
145+
fn filter_name(&self) -> String {
146+
"function_with_parameter".to_string()
147+
}
148+
149+
fn description(&self) -> String {
150+
"Find a function with a given parameter".to_string()
151+
}
152+
153+
fn supports(&self) -> Self::Supports {
154+
Language("Python".to_owned())
155+
}
156+
157+
fn attributes(&self) -> Attributes {
158+
HashMap::from([(Attribute("Name".to_string()), AttributeType::String)])
159+
}
160+
161+
type Supports = Language;
162+
}
163+
164+
impl Filter for FunctionWithParameterPython {
165+
fn parse_filter(&self, s: &str) -> Result<FilterFunction, String> {
166+
todo!()
167+
}
168+
}

git-function-history-gui/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,9 @@ impl MyEguiApp {
277277
let resp = ui.add(Button::new("add field"));
278278
if resp.clicked() {
279279
inputs.insert(next_field.to_string(), (false, String::new()));
280+
next_field.clear();
280281
}
282+
inputs.retain(|_, input| !input.0);
281283
egui::ComboBox::from_id_source("filter_language_chooser")
282284
.selected_text("Language")
283285
.show_ui(ui, |ui| {

0 commit comments

Comments
 (0)