@@ -10,6 +10,8 @@ use helix_core::{
10 coords_at_pos,
10 coords_at_pos,
11 graphemes::{ensure_grapheme_boundary, next_grapheme_boundary},
11 graphemes::{ensure_grapheme_boundary, next_grapheme_boundary},
12 syntax::{self, HighlightEvent},
12 syntax::{self, HighlightEvent},
13+ unicode::segmentation::UnicodeSegmentation,
14+ unicode::width::UnicodeWidthStr,
13 LineEnding, Position, Range,
15 LineEnding, Position, Range,
15use helix_view::{
17use helix_view::{
@@ -627,7 +629,7 @@ impl EditorView {
629 // set the count
631 // set the count
630− cxt.count = cxt.editor.count.take();
632+ cxt.count = cxt.editor.count;
631 // TODO: edge case: 0j -> reset to 1
633 // TODO: edge case: 0j -> reset to 1
632 // if this fails, count was Some(0)
634 // if this fails, count was Some(0)
633 // debug_assert!(cxt.count != 0);
635 // debug_assert!(cxt.count != 0);
@@ -636,6 +638,9 @@ impl EditorView {
636 cxt.selected_register = cxt.editor.selected_register.take();
638 cxt.selected_register = cxt.editor.selected_register.take();
638 self.handle_keymap_event(mode, cxt, event);
640 self.handle_keymap_event(mode, cxt, event);
641+ if self.keymaps.pending().is_empty() {
642+ cxt.editor.count = None
@@ -795,8 +800,12 @@ impl Component for EditorView {
795 info.render(area, surface, cx);
800 info.render(area, surface, cx);
803+ let key_width = 15u16; // for showing pending keys
804+ let mut status_msg_width = 0;
798 // render status msg
806 // render status msg
799 if let Some((status_msg, severity)) = &cx.editor.status_msg {
807 if let Some((status_msg, severity)) = &cx.editor.status_msg {
808+ status_msg_width = status_msg.width();
800 use helix_view::editor::Severity;
809 use helix_view::editor::Severity;
801 let style = if *severity == Severity::Error {
810 let style = if *severity == Severity::Error {
802 cx.editor.theme.get("error")
811 cx.editor.theme.get("error")
@@ -812,6 +821,28 @@ impl Component for EditorView {
824+ if area.width.saturating_sub(status_msg_width as u16) > key_width {
825+ let mut disp = String::new();
826+ if let Some(count) = cx.editor.count {
827+ disp.push_str(&count.to_string())
829+ for key in self.keymaps.pending() {
830+ let s = key.to_string();
831+ if s.graphemes(true).count() > 1 {
832+ disp.push_str(&format!("<{}>", s));
838+ area.x + area.width.saturating_sub(key_width),
839+ area.y + area.height.saturating_sub(1),
840+ disp.get(disp.len().saturating_sub(key_width as usize)..)
842+ cx.editor.theme.get("ui.text"),
815 if let Some(completion) = &self.completion {
846 if let Some(completion) = &self.completion {
816 completion.render(area, surface, cx);
847 completion.render(area, surface, cx);