From 9a7844987693909925b8663d8aa905231d291410 Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Fri, 13 Nov 2020 05:40:09 +0000 Subject: Add ability to select text during search This removes the restriction of not being able to select text while the search is active, making it a bit less jarring of a UX when the user tries to interact with the terminal during search. Since the selection was used during vi-less search to highlight the focused match, there is now an option for a focused match color, which uses the inverted normal match color by default. This focused match is used for both search modes. Other mouse interactions are now also possible during search, like opening URLs or clicking inside of mouse mode applications. --- alacritty_terminal/src/config/colors.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'alacritty_terminal/src/config') diff --git a/alacritty_terminal/src/config/colors.rs b/alacritty_terminal/src/config/colors.rs index 13a30bef..a292fde4 100644 --- a/alacritty_terminal/src/config/colors.rs +++ b/alacritty_terminal/src/config/colors.rs @@ -15,7 +15,7 @@ pub struct Colors { #[serde(deserialize_with = "failure_default")] pub vi_mode_cursor: CursorColors, #[serde(deserialize_with = "failure_default")] - pub selection: SelectionColors, + pub selection: InvertedCellColors, #[serde(deserialize_with = "failure_default")] normal: NormalColors, #[serde(deserialize_with = "failure_default")] @@ -124,16 +124,16 @@ impl CursorColors { #[serde(default)] #[derive(Deserialize, Debug, Copy, Clone, Default, PartialEq, Eq)] -pub struct SelectionColors { - #[serde(deserialize_with = "failure_default")] - text: DefaultBackgroundCellRgb, +pub struct InvertedCellColors { + #[serde(deserialize_with = "failure_default", alias = "text")] + foreground: DefaultBackgroundCellRgb, #[serde(deserialize_with = "failure_default")] background: DefaultForegroundCellRgb, } -impl SelectionColors { - pub fn text(self) -> CellRgb { - self.text.0 +impl InvertedCellColors { + pub fn foreground(self) -> CellRgb { + self.foreground.0 } pub fn background(self) -> CellRgb { @@ -147,6 +147,8 @@ pub struct SearchColors { #[serde(deserialize_with = "failure_default")] pub matches: MatchColors, #[serde(deserialize_with = "failure_default")] + pub focused_match: InvertedCellColors, + #[serde(deserialize_with = "failure_default")] bar: BarColors, } -- cgit v1.2.3-54-g00ecf