Added show character palette. Need to position correctly.

This commit is contained in:
Mikayla Maki 2022-08-16 23:10:05 -07:00
parent 1f82c0c8bf
commit bf7b3150e4
3 changed files with 18 additions and 2 deletions

View File

@ -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"
}
}

View File

@ -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();

View File

@ -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()),