mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 09:26:19 +04:00
it compiles!
This commit is contained in:
parent
afcb78a538
commit
d151567192
@ -994,6 +994,7 @@ fn set_option(
|
||||
};
|
||||
let config = serde_json::from_value(config).map_err(field_error)?;
|
||||
|
||||
#[cfg(feature = "tokio")]
|
||||
cx.editor
|
||||
.config_events
|
||||
.0
|
||||
@ -1121,6 +1122,7 @@ fn refresh_config(
|
||||
_args: &[Cow<str>],
|
||||
_event: PromptEvent,
|
||||
) -> anyhow::Result<()> {
|
||||
#[cfg(feature = "tokio")]
|
||||
cx.editor.config_events.0.send(ConfigEvent::Refresh)?;
|
||||
Ok(())
|
||||
}
|
||||
|
@ -190,6 +190,7 @@ pub fn render(&mut self, area: Rect, cx: &mut RenderContext) {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "term")]
|
||||
pub fn cursor(&self, area: Rect, editor: &Editor) -> (Option<Position>, CursorKind) {
|
||||
for layer in self.layers.iter().rev() {
|
||||
if let (Some(pos), kind) = layer.cursor(area, editor) {
|
||||
|
@ -43,10 +43,10 @@ pub fn default() -> HashMap<Mode, Keymap> {
|
||||
"h" => goto_line_start,
|
||||
"l" => goto_line_end,
|
||||
"s" => goto_first_nonwhitespace,
|
||||
"d" => goto_definition,
|
||||
"y" => goto_type_definition,
|
||||
"r" => goto_reference,
|
||||
"i" => goto_implementation,
|
||||
// "d" => goto_definition,
|
||||
// "y" => goto_type_definition,
|
||||
// "r" => goto_reference,
|
||||
// "i" => goto_implementation,
|
||||
"t" => goto_window_top,
|
||||
"c" => goto_window_center,
|
||||
"b" => goto_window_bottom,
|
||||
@ -198,9 +198,9 @@ pub fn default() -> HashMap<Mode, Keymap> {
|
||||
"f" => file_picker,
|
||||
"F" => file_picker_in_current_directory,
|
||||
"b" => buffer_picker,
|
||||
"s" => symbol_picker,
|
||||
"S" => workspace_symbol_picker,
|
||||
"a" => code_action,
|
||||
// "s" => symbol_picker,
|
||||
// "S" => workspace_symbol_picker,
|
||||
// "a" => code_action,
|
||||
"'" => last_picker,
|
||||
"w" => { "Window"
|
||||
"C-w" | "w" => rotate_view,
|
||||
@ -225,8 +225,8 @@ pub fn default() -> HashMap<Mode, Keymap> {
|
||||
"P" => paste_clipboard_before,
|
||||
"R" => replace_selections_with_clipboard,
|
||||
"/" => global_search,
|
||||
"k" => hover,
|
||||
"r" => rename_symbol,
|
||||
// "k" => hover,
|
||||
// "r" => rename_symbol,
|
||||
"?" => command_palette,
|
||||
},
|
||||
"z" => { "View"
|
||||
|
@ -55,6 +55,7 @@ pub fn new(keymaps: Keymaps) -> Self {
|
||||
keymaps,
|
||||
on_next_key: None,
|
||||
last_insert: (commands::MappableCommand::normal_mode, Vec::new()),
|
||||
#[cfg(feature = "term")]
|
||||
completion: None,
|
||||
spinners: ProgressSpinners::default(),
|
||||
}
|
||||
@ -1189,6 +1190,7 @@ fn handle_event(
|
||||
EventResult::Consumed(None)
|
||||
}
|
||||
Event::Key(mut key) => {
|
||||
#[cfg(feature = "term")]
|
||||
cx.editor.reset_idle_timer();
|
||||
canonicalize_key(&mut key);
|
||||
|
||||
@ -1206,6 +1208,7 @@ fn handle_event(
|
||||
Mode::Insert => {
|
||||
// let completion swallow the event if necessary
|
||||
let mut consumed = false;
|
||||
#[cfg(feature = "term")]
|
||||
if let Some(completion) = &mut self.completion {
|
||||
// use a fake context here
|
||||
let mut cx = Context {
|
||||
@ -1226,6 +1229,7 @@ fn handle_event(
|
||||
|
||||
// if completion didn't take the event, we pass it onto commands
|
||||
if !consumed {
|
||||
#[cfg(feature = "term")]
|
||||
if let Some(compl) = cx.editor.last_completion.take() {
|
||||
self.last_insert.1.push(InsertEvent::CompletionApply(compl));
|
||||
}
|
||||
@ -1236,6 +1240,7 @@ fn handle_event(
|
||||
self.last_insert.1.push(InsertEvent::Key(key));
|
||||
|
||||
// lastly we recalculate completion
|
||||
#[cfg(feature = "term")]
|
||||
if let Some(completion) = &mut self.completion {
|
||||
completion.update(&mut cx);
|
||||
if completion.is_empty() {
|
||||
@ -1283,6 +1288,7 @@ fn handle_event(
|
||||
};
|
||||
self.last_insert.1.clear();
|
||||
}
|
||||
#[cfg(feature = "term")]
|
||||
(Mode::Insert, Mode::Normal) => {
|
||||
// if exiting insert mode, remove completion
|
||||
self.completion = None;
|
||||
|
Loading…
Reference in New Issue
Block a user