diff --git a/book/src/configuration.md b/book/src/configuration.md index 7514a3d0fcc3..7db1d210cacf 100644 --- a/book/src/configuration.md +++ b/book/src/configuration.md @@ -108,6 +108,7 @@ The following statusline elements can be configured: | `primary-selection-length` | The number of characters currently in primary selection | | `position` | The cursor position | | `position-percentage` | The cursor position as a percentage of the total number of lines | +| `code-point` | The code point under the cursor | | `separator` | The string defined in `editor.statusline.separator` (defaults to `"│"`) | | `spacer` | Inserts a space between elements (multiple/contiguous spacers may be specified) | diff --git a/helix-term/src/ui/statusline.rs b/helix-term/src/ui/statusline.rs index a25b4540d1f9..a619cb9ffbe2 100644 --- a/helix-term/src/ui/statusline.rs +++ b/helix-term/src/ui/statusline.rs @@ -153,6 +153,7 @@ where helix_view::editor::StatusLineElement::Position => render_position, helix_view::editor::StatusLineElement::PositionPercentage => render_position_percentage, helix_view::editor::StatusLineElement::TotalLineNumbers => render_total_line_numbers, + helix_view::editor::StatusLineElement::CodePoint => render_code_point, helix_view::editor::StatusLineElement::Separator => render_separator, helix_view::editor::StatusLineElement::Spacer => render_spacer, } @@ -447,6 +448,22 @@ where write(context, title, None); } +fn render_code_point(context: &mut RenderContext, write: F) +where + F: Fn(&mut RenderContext, String, Option