|
|
@ -21,7 +21,6 @@ use helix_view::{
|
|
|
|
document::{Mode, SCRATCH_BUFFER_NAME},
|
|
|
|
document::{Mode, SCRATCH_BUFFER_NAME},
|
|
|
|
editor::CursorShapeConfig,
|
|
|
|
editor::CursorShapeConfig,
|
|
|
|
graphics::{CursorKind, Modifier, Rect, Style},
|
|
|
|
graphics::{CursorKind, Modifier, Rect, Style},
|
|
|
|
info::Info,
|
|
|
|
|
|
|
|
input::KeyEvent,
|
|
|
|
input::KeyEvent,
|
|
|
|
keyboard::{KeyCode, KeyModifiers},
|
|
|
|
keyboard::{KeyCode, KeyModifiers},
|
|
|
|
Document, Editor, Theme, View,
|
|
|
|
Document, Editor, Theme, View,
|
|
|
@ -37,7 +36,6 @@ pub struct EditorView {
|
|
|
|
last_insert: (commands::MappableCommand, Vec<KeyEvent>),
|
|
|
|
last_insert: (commands::MappableCommand, Vec<KeyEvent>),
|
|
|
|
pub(crate) completion: Option<Completion>,
|
|
|
|
pub(crate) completion: Option<Completion>,
|
|
|
|
spinners: ProgressSpinners,
|
|
|
|
spinners: ProgressSpinners,
|
|
|
|
autoinfo: Option<Info>,
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl Default for EditorView {
|
|
|
|
impl Default for EditorView {
|
|
|
@ -54,7 +52,6 @@ impl EditorView {
|
|
|
|
last_insert: (commands::MappableCommand::normal_mode, Vec::new()),
|
|
|
|
last_insert: (commands::MappableCommand::normal_mode, Vec::new()),
|
|
|
|
completion: None,
|
|
|
|
completion: None,
|
|
|
|
spinners: ProgressSpinners::default(),
|
|
|
|
spinners: ProgressSpinners::default(),
|
|
|
|
autoinfo: None,
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -678,13 +675,13 @@ impl EditorView {
|
|
|
|
cxt: &mut commands::Context,
|
|
|
|
cxt: &mut commands::Context,
|
|
|
|
event: KeyEvent,
|
|
|
|
event: KeyEvent,
|
|
|
|
) -> Option<KeymapResult> {
|
|
|
|
) -> Option<KeymapResult> {
|
|
|
|
self.autoinfo = None;
|
|
|
|
cxt.editor.autoinfo = None;
|
|
|
|
let key_result = self.keymaps.get_mut(&mode).unwrap().get(event);
|
|
|
|
let key_result = self.keymaps.get_mut(&mode).unwrap().get(event);
|
|
|
|
self.autoinfo = key_result.sticky.map(|node| node.infobox());
|
|
|
|
cxt.editor.autoinfo = key_result.sticky.map(|node| node.infobox());
|
|
|
|
|
|
|
|
|
|
|
|
match &key_result.kind {
|
|
|
|
match &key_result.kind {
|
|
|
|
KeymapResultKind::Matched(command) => command.execute(cxt),
|
|
|
|
KeymapResultKind::Matched(command) => command.execute(cxt),
|
|
|
|
KeymapResultKind::Pending(node) => self.autoinfo = Some(node.infobox()),
|
|
|
|
KeymapResultKind::Pending(node) => cxt.editor.autoinfo = Some(node.infobox()),
|
|
|
|
KeymapResultKind::MatchedSequence(commands) => {
|
|
|
|
KeymapResultKind::MatchedSequence(commands) => {
|
|
|
|
for command in commands {
|
|
|
|
for command in commands {
|
|
|
|
command.execute(cxt);
|
|
|
|
command.execute(cxt);
|
|
|
@ -1093,8 +1090,9 @@ impl Component for EditorView {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if cx.editor.config.auto_info {
|
|
|
|
if cx.editor.config.auto_info {
|
|
|
|
if let Some(ref mut info) = self.autoinfo {
|
|
|
|
if let Some(mut info) = cx.editor.autoinfo.take() {
|
|
|
|
info.render(area, surface, cx);
|
|
|
|
info.render(area, surface, cx);
|
|
|
|
|
|
|
|
cx.editor.autoinfo = Some(info)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|