1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-11 13:51:01 -05:00

Add option to persist hints after selection

Closes #6976.
This commit is contained in:
Sonu Bardai 2023-06-15 05:33:38 +05:30 committed by GitHub
parent cad0cbeca6
commit be03effdbe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 2 deletions

View file

@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Added ### Added
- Warnings for unused configuration file options - Warnings for unused configuration file options
- Config option `persist` in `hints` config section
### Changed ### Changed

View file

@ -274,6 +274,7 @@ impl Default for Hints {
enabled: vec![Hint { enabled: vec![Hint {
content, content,
action, action,
persist: false,
post_processing: true, post_processing: true,
mouse: Some(HintMouse { enabled: true, mods: Default::default() }), mouse: Some(HintMouse { enabled: true, mods: Default::default() }),
binding: Some(HintBinding { binding: Some(HintBinding {
@ -366,6 +367,10 @@ pub struct Hint {
#[serde(default)] #[serde(default)]
pub post_processing: bool, pub post_processing: bool,
/// Persist hints after selection.
#[serde(default)]
pub persist: bool,
/// Hint mouse highlighting. /// Hint mouse highlighting.
pub mouse: Option<HintMouse>, pub mouse: Option<HintMouse>,

View file

@ -150,7 +150,12 @@ impl HintState {
let bounds = self.matches[index].clone(); let bounds = self.matches[index].clone();
let action = hint.action.clone(); let action = hint.action.clone();
// Exit hint mode unless it requires explicit dismissal.
if hint.persist {
self.keys.clear();
} else {
self.stop(); self.stop();
}
// Hyperlinks take precedence over regex matches. // Hyperlinks take precedence over regex matches.
let hyperlink = term.grid()[*bounds.start()].hyperlink(); let hyperlink = term.grid()[*bounds.start()].hyperlink();

View file

@ -35,10 +35,14 @@ This section documents the root level of the configuration file.
Live config reload (changes require restart) Live config reload (changes require restart)
Default: _true_
*ipc_socket* <boolean> _(unix only)_ *ipc_socket* <boolean> _(unix only)_
Offer IPC using _alacritty msg_ Offer IPC using _alacritty msg_
Default: _true_
# ENV # ENV
All key-value pairs in the *env* section will be added as environment variables All key-value pairs in the *env* section will be added as environment variables
@ -410,6 +414,8 @@ Colors are specified using their hexadecimal values with a _#_ prefix: _#RRGGBB_
When _true_, bold text is drawn using the bright color variants. When _true_, bold text is drawn using the bright color variants.
Default: _false_
# Bell # Bell
This section documents the *[bell]* table of the configuration file. This section documents the *[bell]* table of the configuration file.
@ -563,7 +569,7 @@ terminal and pipe it to other applications.
Default: _"jfkdls;ahgurieowpq"_ Default: _"jfkdls;ahgurieowpq"_
*enabled* [{ <regex>, <hyperlinks>, <post_processing>, <action>, <command> <binding>, <mouse> },] *enabled* [{ <regex>, <hyperlinks>, <post_processing>, <persist>, <action>, <command> <binding>, <mouse> },]
Array with all available hints. Array with all available hints.
@ -585,6 +591,10 @@ _action_ or a _command_.
there are characters likely not to be part of the hint (e.g. a trailing there are characters likely not to be part of the hint (e.g. a trailing
_._). This is most useful for URIs and applies only to _regex_ matches. _._). This is most useful for URIs and applies only to _regex_ matches.
*persist* <boolean>
When this is _true_, hints remain persistent after selection.
*action* "Copy" | "Paste" | "Select" | "MoveViModeCursor" *action* "Copy" | "Paste" | "Select" | "MoveViModeCursor"
*Copy* *Copy*
@ -621,6 +631,7 @@ Default: _[{
regex = "(mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)[^\\u0000-\\u001F\\u007F-\\u009F<>\\"\\\\s{-}\\\\^⟨⟩`]+",++ regex = "(mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)[^\\u0000-\\u001F\\u007F-\\u009F<>\\"\\\\s{-}\\\\^⟨⟩`]+",++
hyperlinks = true,++ hyperlinks = true,++
post_processing = true,++ post_processing = true,++
persist = false,++
mouse = { enabled = true },++ mouse = { enabled = true },++
binding = { key = "U", mods = "Control | Shift" }, binding = { key = "U", mods = "Control | Shift" },
}]_ }]_