basic terminal functionality works

This commit is contained in:
Yehowshua Immanuel 2024-12-24 19:07:11 -05:00
parent e08c673e86
commit 4fd4b6eb17
3 changed files with 11 additions and 5 deletions

View file

@ -72,7 +72,6 @@ fn send_char(
Task::start(async move {
println!("Sending char: {}", &c);
crate::platform::send_char(send_c.to_string()).await;
// crate::platform::unload_signal().await;
println!("Sent char: {}", &c);
});
}

View file

@ -38,7 +38,7 @@ pub struct ATerm {
impl ATerm {
pub fn new() -> result::Result<ATerm, std::io::Error> {
let (rows, cols) = (21, 158);
let (rows, cols) = (21, 90);
let id = 1;
let pty_config = tty::Options {
shell: Some(tty::Shell::new("/bin/bash".to_string(), vec![])),

View file

@ -22,6 +22,7 @@ type RemovedDiagramConnectorsCount = usize;
type DiagramConnectorPath = String;
type DiagramConnectorName = String;
type ComponentId = String;
use alacritty_terminal::event::Notify;
mod component_manager;
mod aterm;
@ -154,9 +155,15 @@ async fn unload_signal(signal_ref_index: usize, store: tauri::State<'_, Store>)
}
#[tauri::command(rename_all = "snake_case")]
async fn send_char() -> Result<(), ()> {
println!("Sending char: {}", "a");
Ok(())
async fn send_char(c : String) -> Result<(), ()> {
// see if length of c is 1
if c.len() == 1 {
let term = TERM.lock().unwrap();
term.tx.notify(c.into_bytes());
Ok(())
} else {
Err(())
}
}
#[tauri::command(rename_all = "snake_case")]