diff options
| author | a-kenji <aks.kenji@protonmail.com> | 2021-11-01 08:52:55 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-01 08:52:55 +0100 |
| commit | d2b81293df36efae1a9a21497f1f46095dff963a (patch) | |
| tree | 5f176608ba09bded5f68ccc99731ca2ec65fcfdf | |
| parent | docs(changelog): fix unused import on darwin (diff) | |
| download | sl0ppij-d2b81293df36efae1a9a21497f1f46095dff963a.tar.gz sl0ppij-d2b81293df36efae1a9a21497f1f46095dff963a.tar.xz sl0ppij-d2b81293df36efae1a9a21497f1f46095dff963a.zip | |
add: `WriteChars` action (#825)
* Behaves like the `Write` action, but one can specify
strings themselves instead of their bytecodes.
Usage:
WriteChars: "cargo make test",
| -rw-r--r-- | zellij-server/src/route.rs | 11 | ||||
| -rw-r--r-- | zellij-utils/src/input/actions.rs | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/zellij-server/src/route.rs b/zellij-server/src/route.rs index 9b1201b6..bb9e733d 100644 --- a/zellij-server/src/route.rs +++ b/zellij-server/src/route.rs @@ -50,6 +50,17 @@ fn route_action( .send_to_screen(ScreenInstruction::WriteCharacter(val, client_id)) .unwrap(); } + Action::WriteChars(val) => { + session + .senders + .send_to_screen(ScreenInstruction::ClearScroll(client_id)) + .unwrap(); + let val = Vec::from(val.as_bytes()); + session + .senders + .send_to_screen(ScreenInstruction::WriteCharacter(val, client_id)) + .unwrap(); + } Action::SwitchToMode(mode) => { let palette = session.palette; // TODO: use the palette from the client and remove it from the server os api diff --git a/zellij-utils/src/input/actions.rs b/zellij-utils/src/input/actions.rs index 8446bf0d..c1277db1 100644 --- a/zellij-utils/src/input/actions.rs +++ b/zellij-utils/src/input/actions.rs @@ -28,6 +28,8 @@ pub enum Action { Quit, /// Write to the terminal. Write(Vec<u8>), + /// Write Characters to the terminal. + WriteChars(String), /// Switch to the specified input mode. SwitchToMode(InputMode), /// Resize focus pane in specified direction. |
