diff options
author | Thomas Linford <tlinford@users.noreply.github.com> | 2021-08-23 15:51:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-23 15:51:33 +0200 |
commit | 94f20cfd5312f828c9180e7bcb5d760c09829a56 (patch) | |
tree | 05cb55c1aa80f59d58ae9ca00f10d15344857eb4 /default-plugins/status-bar/src/second_line.rs | |
parent | d1b5a6991807e2558b828c44a79b2b37af2b1094 (diff) |
Indicate to the user when text is copied to the clipboard (#642)
* Indicate to the user when text is copied to the clipboard
- broadcast CopyToClipboard event to plugins after selection has been
copied, and InputReceived event after any input has been received.
- add new ClientToServerMsg InputReceived
- subscribe status-bar plugin to new events, modify second line after
CopyToClipboard, reset it on InputReceived.
* remove unnecessary InputReceived ClientToServerMsg
- use existing Actions instead to know that user input has been received
* make status bar text copied hint bold green
* cleanup
* cleanup
* cleanup
Diffstat (limited to 'default-plugins/status-bar/src/second_line.rs')
-rw-r--r-- | default-plugins/status-bar/src/second_line.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/default-plugins/status-bar/src/second_line.rs b/default-plugins/status-bar/src/second_line.rs index 750df77b6..d73cb2874 100644 --- a/default-plugins/status-bar/src/second_line.rs +++ b/default-plugins/status-bar/src/second_line.rs @@ -375,3 +375,15 @@ pub fn keybinds(help: &ModeInfo, max_width: usize) -> LinePart { } best_effort_shortcut_list(help, max_width) } + +pub fn text_copied_hint(palette: &Palette) -> LinePart { + let hint = " Text copied to clipboard"; + let green_color = match palette.green { + PaletteColor::Rgb((r, g, b)) => RGB(r, g, b), + PaletteColor::EightBit(color) => Fixed(color), + }; + LinePart { + part: format!("{}", Style::new().fg(green_color).bold().paint(hint)), + len: hint.len(), + } +} |