Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/ui/app_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,11 @@ impl Nova {
active_tab.grid.input_start_col = Some(col);
active_tab.grid.input_start_row = Some(active_tab.grid.cursor_y);
}
} else {
active_tab.current_input.clear();
active_tab.grid.suggestion = None;
active_tab.grid.input_start_col = None;
active_tab.grid.input_start_row = None;
}
}

Expand Down
22 changes: 20 additions & 2 deletions src/ui/components/term.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ fn cell_span(
let rt = theme::color::runtime();
let term_fg = rt.foreground;
let term_bg = rt.background;
let accent = rt.accent;
drop(rt);

let reverse = attrs.contains(crate::core::grid::CellAttrs::REVERSE);
Expand All @@ -298,6 +299,9 @@ fn cell_span(
let strikethrough = attrs.contains(crate::core::grid::CellAttrs::STRIKETHROUGH);
let dim = attrs.contains(crate::core::grid::CellAttrs::DIM);

let original_fg = fg;
let original_bg = bg;

if dim {
if let Some(c) = fg.as_mut() {
c.a = 0.5;
Expand Down Expand Up @@ -327,7 +331,11 @@ fn cell_span(

if reverse {
let rev_fg = bg.unwrap_or(term_bg);
let rev_bg = fg.unwrap_or(term_fg);
let rev_bg = if original_fg.is_none() && original_bg.is_none() {
accent
} else {
fg.unwrap_or(term_fg)
};
Span::new(text)
.color(rev_fg)
.background(Background::Color(rev_bg))
Expand All @@ -344,7 +352,17 @@ fn cell_span(
.font(font)
.size(font_size);
if let Some(bg_color) = bg {
span = span.background(Background::Color(bg_color));
let is_selection_like = bg_color.r > 0.85
&& bg_color.g > 0.85
&& bg_color.b > 0.85
&& color.r < 0.3
&& color.g < 0.3
&& color.b < 0.3;
if is_selection_like {
span = span.background(Background::Color(accent));
} else {
span = span.background(Background::Color(bg_color));
}
}
span
}
Expand Down