Skip to content

Commit

Permalink
chore: styles for the GenerateView
Browse files Browse the repository at this point in the history
  • Loading branch information
covercash2 committed Nov 24, 2024
1 parent 5981e12 commit d8609da
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions ollama-cli/src/tui/generate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::{
use super::{
event::Action,
input::{InputView, TextInputEvent, TextInputViewModel},
AppEvent,
AppEvent, StyleExt as _,
};

#[derive(Debug, Default, Clone, Copy, PartialEq)]
Expand Down Expand Up @@ -133,9 +133,26 @@ pub impl<'a> Frame<'a> {

let [input_area, output_area] = vertical.areas(parent);

self.input_view(input_area, style, &view_model.input);
let input_style = if let Some(Pane::Input) = view_model.active_pane {
Style::active()
} else if view_model.focused_pane == Pane::Input {
Style::focused()
} else {
style
};

self.input_view(input_area, input_style, &view_model.input);

let output_style = if let Some(Pane::Output) = view_model.active_pane {
Style::active()
} else if view_model.focused_pane == Pane::Output {
Style::focused()
} else {
style
};

let output = Paragraph::new(view_model.output.as_str())
.style(output_style)
.wrap(Wrap { trim: true })
.block(Block::bordered());

Expand Down

0 comments on commit d8609da

Please sign in to comment.