mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-24 17:28:40 +00:00
Fix space and copy/paste when editing a channel
This commit is contained in:
parent
19a9753663
commit
667fc25766
2 changed files with 31 additions and 2 deletions
|
@ -588,14 +588,20 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"context": "CollabPanel",
|
||||
"context": "CollabPanel && not_editing",
|
||||
"bindings": {
|
||||
"ctrl-backspace": "collab_panel::Remove",
|
||||
"space": "menu::Confirm"
|
||||
}
|
||||
},
|
||||
{
|
||||
"context": "CollabPanel > Editor",
|
||||
"context": "(CollabPanel && editing) > Editor",
|
||||
"bindings": {
|
||||
"space": "collab_panel::InsertSpace"
|
||||
}
|
||||
},
|
||||
{
|
||||
"context": "(CollabPanel && not_editing) > Editor",
|
||||
"bindings": {
|
||||
"cmd-c": "collab_panel::StartLinkChannel",
|
||||
"cmd-x": "collab_panel::StartMoveChannel",
|
||||
|
|
|
@ -136,6 +136,7 @@ actions!(
|
|||
StartMoveChannel,
|
||||
StartLinkChannel,
|
||||
MoveOrLinkToSelected,
|
||||
InsertSpace,
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -184,6 +185,7 @@ pub fn init(cx: &mut AppContext) {
|
|||
cx.add_action(CollabPanel::select_next);
|
||||
cx.add_action(CollabPanel::select_prev);
|
||||
cx.add_action(CollabPanel::confirm);
|
||||
cx.add_action(CollabPanel::insert_space);
|
||||
cx.add_action(CollabPanel::remove);
|
||||
cx.add_action(CollabPanel::remove_selected_channel);
|
||||
cx.add_action(CollabPanel::show_inline_context_menu);
|
||||
|
@ -2518,6 +2520,14 @@ impl CollabPanel {
|
|||
}
|
||||
}
|
||||
|
||||
fn insert_space(&mut self, _: &InsertSpace, cx: &mut ViewContext<Self>) {
|
||||
if self.channel_editing_state.is_some() {
|
||||
self.channel_name_editor.update(cx, |editor, cx| {
|
||||
editor.insert(" ", cx);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
fn confirm_channel_edit(&mut self, cx: &mut ViewContext<CollabPanel>) -> bool {
|
||||
if let Some(editing_state) = &mut self.channel_editing_state {
|
||||
match editing_state {
|
||||
|
@ -3054,6 +3064,19 @@ impl View for CollabPanel {
|
|||
.on_click(MouseButton::Left, |_, _, cx| cx.focus_self())
|
||||
.into_any_named("collab panel")
|
||||
}
|
||||
|
||||
fn update_keymap_context(
|
||||
&self,
|
||||
keymap: &mut gpui::keymap_matcher::KeymapContext,
|
||||
_: &AppContext,
|
||||
) {
|
||||
Self::reset_to_default_keymap_context(keymap);
|
||||
if self.channel_editing_state.is_some() {
|
||||
keymap.add_identifier("editing");
|
||||
} else {
|
||||
keymap.add_identifier("not_editing");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Panel for CollabPanel {
|
||||
|
|
Loading…
Reference in a new issue