From e3d2fe3d9b07bb290e0de895dae95031d82f883a Mon Sep 17 00:00:00 2001 From: Ellis Gibbons Date: Thu, 8 Jun 2023 00:22:24 -0400 Subject: [PATCH] Add visual feedback for select_register command Resolves issue #1585 by adding a new statusline component which indicates the currently selected register. --- book/src/configuration.md | 1 + helix-term/src/ui/statusline.rs | 10 ++++++++++ helix-view/src/editor.rs | 11 ++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/book/src/configuration.md b/book/src/configuration.md index 253a07269d18..ed2d61dd2c0a 100644 --- a/book/src/configuration.md +++ b/book/src/configuration.md @@ -117,6 +117,7 @@ The following statusline elements can be configured: | `separator` | The string defined in `editor.statusline.separator` (defaults to `"│"`) | | `spacer` | Inserts a space between elements (multiple/contiguous spacers may be specified) | | `version-control` | The current branch name or detached commit hash of the opened workspace | +| `register` | The current selected register | ### `[editor.lsp]` Section diff --git a/helix-term/src/ui/statusline.rs b/helix-term/src/ui/statusline.rs index dbf5ac314898..61fca609b208 100644 --- a/helix-term/src/ui/statusline.rs +++ b/helix-term/src/ui/statusline.rs @@ -160,6 +160,7 @@ where helix_view::editor::StatusLineElement::Separator => render_separator, helix_view::editor::StatusLineElement::Spacer => render_spacer, helix_view::editor::StatusLineElement::VersionControl => render_version_control, + helix_view::editor::StatusLineElement::Register => render_register, } } @@ -489,3 +490,12 @@ where write(context, head, None); } + +fn render_register(context: &mut RenderContext, write: F) +where + F: Fn(&mut RenderContext, String, Option