Skip to content

Commit

Permalink
Make prompt use cursor set for Insert mode (helix-editor#10945)
Browse files Browse the repository at this point in the history
* Resolve issue helix-editor#10874

* cargo fmt
  • Loading branch information
GNUSheep authored and Schuyler Mortimer committed Jul 10, 2024
1 parent 556eea9 commit 7a19e38
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions helix-term/src/ui/prompt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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 std::sync::Arc;
Expand Down Expand Up @@ -662,7 +663,7 @@ impl Component for Prompt {
self.render_prompt(area, surface, cx)
}

fn cursor(&self, area: Rect, _editor: &Editor) -> (Option<Position>, CursorKind) {
fn cursor(&self, area: Rect, editor: &Editor) -> (Option<Position>, CursorKind) {
let line = area.height as usize - 1;
(
Some(Position::new(
Expand All @@ -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),
)
}
}

0 comments on commit 7a19e38

Please sign in to comment.