From 3dd2196e4f42b23fd30b4e028b96d5b1862603d6 Mon Sep 17 00:00:00 2001 From: Seth Bromberger Date: Tue, 26 Jul 2022 08:05:12 +0200 Subject: add position-percentage as a statusline indicator (#3168) * added position-pct as a statusline indicator * removed unnecessary mutable reference * pct -> percent * percent -> percentage--- helix-term/src/ui/statusline.rs | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'helix-term/src') diff --git a/helix-term/src/ui/statusline.rs b/helix-term/src/ui/statusline.rs index e9e478bf..df6d4800 100644 --- a/helix-term/src/ui/statusline.rs +++ b/helix-term/src/ui/statusline.rs @@ -1,4 +1,4 @@ -use helix_core::{coords_at_pos, encoding}; +use helix_core::{coords_at_pos, encoding, Position}; use helix_view::{ document::{Mode, SCRATCH_BUFFER_NAME}, graphics::Rect, @@ -143,6 +143,7 @@ where helix_view::editor::StatusLineElement::Diagnostics => render_diagnostics, helix_view::editor::StatusLineElement::Selections => render_selections, helix_view::editor::StatusLineElement::Position => render_position, + helix_view::editor::StatusLineElement::PositionPercentage => render_position_percentage, helix_view::editor::StatusLineElement::Spacer => render_spacer, } } @@ -251,19 +252,22 @@ where ); } -fn render_position(context: &mut RenderContext, write: F) -where - F: Fn(&mut RenderContext, String, Option