Make prompt use cursor set for Insert mode (#10945)

* Resolve issue #10874

* cargo fmt
This commit is contained in:
Shaun_Sheep 2024-06-18 10:38:56 +02:00 committed by GitHub
parent dbacaaddca
commit bc73dd19d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;
@ -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(
@ -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),
)
}
}