Skip to content

Commit

Permalink
If values for current_text and prev_text are unchanged, filter ou…
Browse files Browse the repository at this point in the history
…t the previous value.
  • Loading branch information
ndarilek committed May 20, 2021
1 parent 6bf558d commit cd06fa7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion egui/src/data/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,16 @@ impl WidgetInfo {

#[allow(clippy::needless_pass_by_value)]
pub fn text_edit(prev_text_value: impl ToString, text_value: impl ToString) -> Self {
let text_value = text_value.to_string();
let prev_text_value = prev_text_value.to_string();
let prev_text_value = if text_value == prev_text_value {
None
} else {
Some(prev_text_value)
};
Self {
current_text_value: Some(text_value.to_string()),
prev_text_value: Some(prev_text_value.to_string()),
prev_text_value,
..Self::new(WidgetType::TextEdit)
}
}
Expand Down

0 comments on commit cd06fa7

Please sign in to comment.