mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-19 02:17:35 +03:00
Fix renaming sometimes not working in vim mode (#14320)
Disable vim key contexts during renaming, to fix renaming being interfered with vim commands. Release Notes: - Fixed renaming sometimes not working in vim mode [#14292](https://github.com/zed-industries/zed/issues/14292) [#11882](https://github.com/zed-industries/zed/issues/11882). - Fixed inline assistant sometimes not working in vim mode #11559 --------- Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
parent
76594ae5cd
commit
64a796d436
@ -1770,6 +1770,8 @@ impl Editor {
|
|||||||
);
|
);
|
||||||
let focus_handle = cx.focus_handle();
|
let focus_handle = cx.focus_handle();
|
||||||
cx.on_focus(&focus_handle, Self::handle_focus).detach();
|
cx.on_focus(&focus_handle, Self::handle_focus).detach();
|
||||||
|
cx.on_focus_in(&focus_handle, Self::handle_focus_in)
|
||||||
|
.detach();
|
||||||
cx.on_focus_out(&focus_handle, Self::handle_focus_out)
|
cx.on_focus_out(&focus_handle, Self::handle_focus_out)
|
||||||
.detach();
|
.detach();
|
||||||
cx.on_blur(&focus_handle, Self::handle_blur).detach();
|
cx.on_blur(&focus_handle, Self::handle_blur).detach();
|
||||||
@ -11632,6 +11634,10 @@ impl Editor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn handle_focus_in(&mut self, cx: &mut ViewContext<Self>) {
|
||||||
|
cx.emit(EditorEvent::FocusedIn)
|
||||||
|
}
|
||||||
|
|
||||||
fn handle_focus_out(&mut self, event: FocusOutEvent, _cx: &mut ViewContext<Self>) {
|
fn handle_focus_out(&mut self, event: FocusOutEvent, _cx: &mut ViewContext<Self>) {
|
||||||
if event.blurred != self.focus_handle {
|
if event.blurred != self.focus_handle {
|
||||||
self.last_focused_descendant = Some(event.blurred);
|
self.last_focused_descendant = Some(event.blurred);
|
||||||
@ -12236,6 +12242,7 @@ pub enum EditorEvent {
|
|||||||
},
|
},
|
||||||
Reparsed(BufferId),
|
Reparsed(BufferId),
|
||||||
Focused,
|
Focused,
|
||||||
|
FocusedIn,
|
||||||
Blurred,
|
Blurred,
|
||||||
DirtyChanged,
|
DirtyChanged,
|
||||||
Saved,
|
Saved,
|
||||||
|
@ -268,6 +268,7 @@ impl Vim {
|
|||||||
EditorEvent::Edited { .. } => {
|
EditorEvent::Edited { .. } => {
|
||||||
Vim::update(cx, |vim, cx| vim.transaction_ended(editor, cx))
|
Vim::update(cx, |vim, cx| vim.transaction_ended(editor, cx))
|
||||||
}
|
}
|
||||||
|
EditorEvent::FocusedIn => Vim::update(cx, |vim, cx| vim.sync_vim_settings(cx)),
|
||||||
_ => {}
|
_ => {}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user