From ebb41089eabac3f416649de2c831ce0fd63b0e34 Mon Sep 17 00:00:00 2001 From: Matthew Ryan Dillon Date: Thu, 22 Aug 2024 06:56:47 -0400 Subject: [PATCH] strip empty lines --- src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index dbe43ef..3b59106 100644 --- a/src/main.rs +++ b/src/main.rs @@ -41,6 +41,7 @@ fn main() { fn process_text(mut state: ResMut) { if state.needs_update { let mut arr = state.input_value.lines().collect::>(); + arr.retain(|&x| !x.is_empty()); arr.sort_by(|&a, &b| vsort::compare(a, b)); state.output_value = arr.join(LINE_ENDING); state.needs_update = false; @@ -56,7 +57,7 @@ fn ui_system(mut contexts: EguiContexts, mut state: ResMut) { ui.with_layout(egui::Layout::top_down(egui::Align::Center), |ui| { ui.with_layout(egui::Layout::left_to_right(egui::Align::LEFT), |ui| { - let sort_button = ui.button("Sort"); + let sort_button = ui.button("Sort & Remove Blanks"); if sort_button.clicked() { state.needs_update = true; }