Skip to content

Commit

Permalink
Stop errors from wrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasschafer committed Dec 10, 2024
1 parent f35257e commit f790717
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use ratatui::{
Frame,
};

#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct FieldError {
pub short: String,
pub long: String,
Expand Down
16 changes: 7 additions & 9 deletions src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use ratatui::{
layout::{Alignment, Constraint, Direction, Flex, Layout, Rect},
style::{Color, Style, Stylize},
text::{Line, Span, Text},
widgets::{Block, Clear, List, ListItem, Paragraph, Wrap},
widgets::{Block, Clear, List, ListItem, Paragraph},
Frame,
};
use similar::{Change, ChangeTag, TextDiff};
Expand Down Expand Up @@ -64,7 +64,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),
)])
})
Expand All @@ -85,13 +85,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() {
Expand Down
1 change: 1 addition & 0 deletions tests/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit f790717

Please sign in to comment.