From a0389b3aac3a5652dafa8229b7550a1fe66ccc78 Mon Sep 17 00:00:00 2001 From: Nicolas MEYLAN Date: Wed, 1 Jan 2025 15:25:51 +0100 Subject: [PATCH] Use break on newline from layout job instead of replace in string --- src/array_table.rs | 10 +++------- src/components/cell_text.rs | 1 + 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/array_table.rs b/src/array_table.rs index 9995dca..952418d 100644 --- a/src/array_table.rs +++ b/src/array_table.rs @@ -366,6 +366,7 @@ impl<'array> } } + pub const NON_NULL_FILTER_VALUE: &str = "__non_null"; impl<'array> ArrayTable<'array> { @@ -892,18 +893,13 @@ impl<'array> ArrayTable<'array> { } } else if let Some(index) = index { let entry = &row_data.entries()[index]; - let is_array = matches!(entry.pointer.value_type, ValueType::Array(_)); - let is_object = matches!(entry.pointer.value_type, ValueType::Object(..)); + if pinned_column_table && col_index == 0 { let label = Label::new(row_index.to_string()); return Some(label.ui(ui)); } else if let Some(value) = entry.value.as_ref() { if !matches!(entry.pointer.value_type, ValueType::Null) { - let mut label = if is_array || is_object { - CellText::new(value.replace('\n', "")) // maybe we want cache - } else { - CellText::new(value.clone()) - }; + let mut label = CellText::new(value.clone()); let mut response = label.ui(ui, cell_id); diff --git a/src/components/cell_text.rs b/src/components/cell_text.rs index 7228d83..1638566 100644 --- a/src/components/cell_text.rs +++ b/src/components/cell_text.rs @@ -21,6 +21,7 @@ impl CellText { let widget_text = WidgetText::RichText(rich_text); let mut layout_job = widget_text.into_layout_job(ui.style(), FontSelection::Default, valign); + layout_job.break_on_newline = false; layout_job.wrap.max_width = f32::INFINITY; layout_job.halign = Align::LEFT; layout_job.justify = false;