From 589f970c8270c211e8e90cdce2dffbf4f56f0f25 Mon Sep 17 00:00:00 2001 From: thomasschafer Date: Sat, 7 Dec 2024 17:37:48 +0000 Subject: [PATCH] Stop errors from wrapping --- src/fields.rs | 2 +- src/ui.rs | 15 +++++++-------- tests/app.rs | 1 + 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/fields.rs b/src/fields.rs index e996933..ae386f9 100644 --- a/src/fields.rs +++ b/src/fields.rs @@ -7,7 +7,7 @@ use ratatui::{ Frame, }; -#[derive(Clone)] +#[derive(Clone, Debug)] pub struct FieldError { pub short: String, pub long: String, diff --git a/src/ui.rs b/src/ui.rs index 1e11369..855376d 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -1,4 +1,5 @@ use itertools::Itertools; +use log::error; use ratatui::{ layout::{Alignment, Constraint, Direction, Flex, Layout, Rect}, style::{Color, Style, Stylize}, @@ -64,7 +65,7 @@ fn render_search_view(frame: &mut Frame<'_>, app: &App, rect: Rect) { .lines() .map(|line| { Line::from(vec![Span::styled( - format!(" {line}"), + line.to_string(), Style::default().fg(Color::Red), )]) }) @@ -85,13 +86,11 @@ fn render_search_view(frame: &mut Frame<'_>, app: &App, rect: Rect) { Constraint::Length(content_height), ); - let popup = Paragraph::new(error_lines) - .block( - Block::bordered() - .title("Errors") - .title_alignment(Alignment::Center), - ) - .wrap(Wrap { trim: true }); + let popup = Paragraph::new(error_lines).block( + Block::bordered() + .title("Errors") + .title_alignment(Alignment::Center), + ); frame.render_widget(Clear, popup_area); frame.render_widget(popup, popup_area); } else if let Some(cursor_idx) = app.search_fields.highlighted_field().read().cursor_idx() { diff --git a/tests/app.rs b/tests/app.rs index a342d09..0927a22 100644 --- a/tests/app.rs +++ b/tests/app.rs @@ -355,6 +355,7 @@ macro_rules! test_with_both_regex_modes { mod $name { use super::*; + // TODO: run max n at a time, rather than serially #[tokio::test] #[serial] async fn with_advanced_regex() {