Allow cursors to be shown via a command
This commit is contained in:
parent
4ce0c27e0a
commit
0062cc000b
4 changed files with 23 additions and 12 deletions
|
@ -349,7 +349,8 @@
|
||||||
"alt-cmd-]": "editor::UnfoldLines",
|
"alt-cmd-]": "editor::UnfoldLines",
|
||||||
"ctrl-space": "editor::ShowCompletions",
|
"ctrl-space": "editor::ShowCompletions",
|
||||||
"cmd-.": "editor::ToggleCodeActions",
|
"cmd-.": "editor::ToggleCodeActions",
|
||||||
"alt-cmd-r": "editor::RevealInFinder"
|
"alt-cmd-r": "editor::RevealInFinder",
|
||||||
|
"ctrl-cmd-c": "editor::ShowCursors"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -214,5 +214,6 @@ gpui::actions!(
|
||||||
Undo,
|
Undo,
|
||||||
UndoSelection,
|
UndoSelection,
|
||||||
UnfoldLines,
|
UnfoldLines,
|
||||||
|
ShowCursors
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
|
@ -3899,6 +3899,24 @@ impl Editor {
|
||||||
self.update_visible_copilot_suggestion(cx);
|
self.update_visible_copilot_suggestion(cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn show_cursors(&mut self, _: &ShowCursors, cx: &mut ViewContext<Self>) {
|
||||||
|
self.display_cursors(cx);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn display_cursors(&mut self, cx: &mut ViewContext<Self>) {
|
||||||
|
self.recently_focused = true;
|
||||||
|
cx.notify();
|
||||||
|
cx.spawn(|this, mut cx| async move {
|
||||||
|
cx.background_executor().timer(Duration::from_secs(2)).await;
|
||||||
|
this.update(&mut cx, |this, cx| {
|
||||||
|
this.recently_focused = false;
|
||||||
|
cx.notify()
|
||||||
|
})
|
||||||
|
.ok()
|
||||||
|
})
|
||||||
|
.detach();
|
||||||
|
}
|
||||||
|
|
||||||
fn next_copilot_suggestion(&mut self, _: &copilot::NextSuggestion, cx: &mut ViewContext<Self>) {
|
fn next_copilot_suggestion(&mut self, _: &copilot::NextSuggestion, cx: &mut ViewContext<Self>) {
|
||||||
if self.has_active_copilot_suggestion(cx) {
|
if self.has_active_copilot_suggestion(cx) {
|
||||||
self.cycle_copilot_suggestions(Direction::Next, cx);
|
self.cycle_copilot_suggestions(Direction::Next, cx);
|
||||||
|
@ -9003,17 +9021,7 @@ impl Editor {
|
||||||
cx.focus(&rename_editor_focus_handle);
|
cx.focus(&rename_editor_focus_handle);
|
||||||
} else {
|
} else {
|
||||||
self.blink_manager.update(cx, BlinkManager::enable);
|
self.blink_manager.update(cx, BlinkManager::enable);
|
||||||
self.recently_focused = true;
|
self.display_cursors(cx);
|
||||||
cx.notify();
|
|
||||||
cx.spawn(|this, mut cx| async move {
|
|
||||||
cx.background_executor().timer(Duration::from_secs(2)).await;
|
|
||||||
this.update(&mut cx, |this, cx| {
|
|
||||||
this.recently_focused = false;
|
|
||||||
cx.notify()
|
|
||||||
})
|
|
||||||
.ok()
|
|
||||||
})
|
|
||||||
.detach();
|
|
||||||
self.buffer.update(cx, |buffer, cx| {
|
self.buffer.update(cx, |buffer, cx| {
|
||||||
buffer.finalize_last_transaction(cx);
|
buffer.finalize_last_transaction(cx);
|
||||||
if self.leader_peer_id.is_none() {
|
if self.leader_peer_id.is_none() {
|
||||||
|
|
|
@ -327,6 +327,7 @@ impl EditorElement {
|
||||||
register_action(view, cx, Editor::context_menu_prev);
|
register_action(view, cx, Editor::context_menu_prev);
|
||||||
register_action(view, cx, Editor::context_menu_next);
|
register_action(view, cx, Editor::context_menu_next);
|
||||||
register_action(view, cx, Editor::context_menu_last);
|
register_action(view, cx, Editor::context_menu_last);
|
||||||
|
register_action(view, cx, Editor::show_cursors);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn register_key_listeners(&self, cx: &mut WindowContext) {
|
fn register_key_listeners(&self, cx: &mut WindowContext) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue