strip empty lines
This commit is contained in:
parent
7b96493b28
commit
ebb41089ea
1 changed files with 2 additions and 1 deletions
|
@ -41,6 +41,7 @@ fn main() {
|
||||||
fn process_text(mut state: ResMut<State>) {
|
fn process_text(mut state: ResMut<State>) {
|
||||||
if state.needs_update {
|
if state.needs_update {
|
||||||
let mut arr = state.input_value.lines().collect::<Vec<_>>();
|
let mut arr = state.input_value.lines().collect::<Vec<_>>();
|
||||||
|
arr.retain(|&x| !x.is_empty());
|
||||||
arr.sort_by(|&a, &b| vsort::compare(a, b));
|
arr.sort_by(|&a, &b| vsort::compare(a, b));
|
||||||
state.output_value = arr.join(LINE_ENDING);
|
state.output_value = arr.join(LINE_ENDING);
|
||||||
state.needs_update = false;
|
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::top_down(egui::Align::Center), |ui| {
|
||||||
ui.with_layout(egui::Layout::left_to_right(egui::Align::LEFT), |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() {
|
if sort_button.clicked() {
|
||||||
state.needs_update = true;
|
state.needs_update = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue