strip empty lines

This commit is contained in:
Matthew Ryan Dillon 2024-08-22 06:56:47 -04:00
parent 7b96493b28
commit ebb41089ea

View file

@ -41,6 +41,7 @@ fn main() {
fn process_text(mut state: ResMut<State>) {
if state.needs_update {
let mut arr = state.input_value.lines().collect::<Vec<_>>();
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<State>) {
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;
}