Added show character palette. Need to position correctly.

Mikayla Maki created

Change summary

assets/keymaps/default.json           |  2 ++
crates/terminal/src/connected_view.rs | 17 ++++++++++++++++-
crates/terminal/src/mappings/keys.rs  |  1 -
3 files changed, 18 insertions(+), 2 deletions(-)

Detailed changes

assets/keymaps/default.json 🔗

@@ -420,6 +420,7 @@
             "enter": "terminal::Enter",
             "ctrl-c": "terminal::CtrlC",
             // Useful terminal actions:
+            "ctrl-cmd-space": "terminal::ShowCharacterPalette",
             "cmd-c": "terminal::Copy",
             "cmd-v": "terminal::Paste",
             "cmd-k": "terminal::Clear"
@@ -428,6 +429,7 @@
     {
         "context": "ModalTerminal",
         "bindings": {
+            "ctrl-cmd-space": "terminal::ShowCharacterPalette",
             "shift-escape": "terminal::DeployModal"
         }
     }

crates/terminal/src/connected_view.rs 🔗

@@ -29,7 +29,17 @@ pub struct DeployContextMenu {
 
 actions!(
     terminal,
-    [Up, Down, CtrlC, Escape, Enter, Clear, Copy, Paste,]
+    [
+        Up,
+        Down,
+        CtrlC,
+        Escape,
+        Enter,
+        Clear,
+        Copy,
+        Paste,
+        ShowCharacterPalette
+    ]
 );
 impl_internal_actions!(project_panel, [DeployContextMenu]);
 
@@ -45,6 +55,7 @@ pub fn init(cx: &mut MutableAppContext) {
     cx.add_action(ConnectedView::copy);
     cx.add_action(ConnectedView::paste);
     cx.add_action(ConnectedView::clear);
+    cx.add_action(ConnectedView::show_character_palette);
 }
 
 ///A terminal view, maintains the PTY's file handles and communicates with the terminal
@@ -126,6 +137,10 @@ impl ConnectedView {
         cx.notify();
     }
 
+    fn show_character_palette(&mut self, _: &ShowCharacterPalette, cx: &mut ViewContext<Self>) {
+        cx.show_character_palette();
+    }
+
     fn clear(&mut self, _: &Clear, cx: &mut ViewContext<Self>) {
         self.terminal.update(cx, |term, _| term.clear());
         cx.notify();

crates/terminal/src/mappings/keys.rs 🔗

@@ -53,7 +53,6 @@ pub fn to_esc_str(keystroke: &Keystroke, mode: &TermMode) -> Option<String> {
     // Manual Bindings including modifiers
     let manual_esc_str = match (keystroke.key.as_ref(), &modifiers) {
         //Basic special keys
-        ("space", Modifiers::None) => Some(" ".to_string()),
         ("tab", Modifiers::None) => Some("\x09".to_string()),
         ("escape", Modifiers::None) => Some("\x1b".to_string()),
         ("enter", Modifiers::None) => Some("\x0d".to_string()),