From 008ccd41db350ceaf156f34b2184e37ad1ae1c1b Mon Sep 17 00:00:00 2001 From: GNUSheep Date: Thu, 13 Jun 2024 19:20:56 +0200 Subject: [PATCH 1/2] Resolve issue #10874 --- helix-term/src/ui/prompt.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs index 3e4e8e1370ab..e4b0acf70735 100644 --- a/helix-term/src/ui/prompt.rs +++ b/helix-term/src/ui/prompt.rs @@ -4,6 +4,7 @@ use arc_swap::ArcSwap; use helix_core::syntax; use helix_view::input::KeyEvent; use helix_view::keyboard::KeyCode; +use helix_view::document::Mode; use std::sync::Arc; use std::{borrow::Cow, ops::RangeFrom}; use tui::buffer::Buffer as Surface; @@ -662,7 +663,7 @@ impl Component for Prompt { self.render_prompt(area, surface, cx) } - fn cursor(&self, area: Rect, _editor: &Editor) -> (Option, CursorKind) { + fn cursor(&self, area: Rect, editor: &Editor) -> (Option, CursorKind) { let line = area.height as usize - 1; ( Some(Position::new( @@ -671,7 +672,7 @@ impl Component for Prompt { + self.prompt.len() + UnicodeWidthStr::width(&self.line[..self.cursor]), )), - CursorKind::Block, + editor.config().cursor_shape.from_mode(Mode::Insert), ) } } From 8c2b6c0d553d090919586b3044082866a9bd2de5 Mon Sep 17 00:00:00 2001 From: GNUSheep Date: Thu, 13 Jun 2024 20:23:45 +0200 Subject: [PATCH 2/2] cargo fmt --- helix-term/src/ui/prompt.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs index e4b0acf70735..14b242df6672 100644 --- a/helix-term/src/ui/prompt.rs +++ b/helix-term/src/ui/prompt.rs @@ -2,9 +2,9 @@ use crate::compositor::{Component, Compositor, Context, Event, EventResult}; use crate::{alt, ctrl, key, shift, ui}; use arc_swap::ArcSwap; use helix_core::syntax; +use helix_view::document::Mode; use helix_view::input::KeyEvent; use helix_view::keyboard::KeyCode; -use helix_view::document::Mode; use std::sync::Arc; use std::{borrow::Cow, ops::RangeFrom}; use tui::buffer::Buffer as Surface;