diff options
author | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2018-09-04 02:10:37 +0300 |
---|---|---|
committer | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2019-06-10 19:40:32 +0300 |
commit | 8d3a2d82366cc86a405ed194eba02e0d47cac70e (patch) | |
tree | 0f2aed412dc2c40dba7ba3fcdd3de5fb55ea7b72 /ui/src/components/mail/listing/mod.rs | |
parent | b94687cdb0ddda05bbf983042f4218dea35b80b1 (diff) |
ui: refactor compose actions
Diffstat (limited to 'ui/src/components/mail/listing/mod.rs')
-rw-r--r-- | ui/src/components/mail/listing/mod.rs | 41 |
1 files changed, 1 insertions, 40 deletions
diff --git a/ui/src/components/mail/listing/mod.rs b/ui/src/components/mail/listing/mod.rs index a96ff7bf..5fa12240 100644 --- a/ui/src/components/mail/listing/mod.rs +++ b/ui/src/components/mail/listing/mod.rs @@ -640,48 +640,9 @@ impl Component for PlainListing { return true; } UIEventType::Input(Key::Char('m')) if !self.unfocused => { - use std::process::{Command, Stdio}; - /* Kill input thread so that spawned command can be sole receiver of stdin */ - { - /* I tried thread::park() here but for some reason it never blocked and always - * returned. Spinlocks are also useless because you have to keep the mutex - * guard alive til the child process exits, which requires some effort. - * - * The only problem with this approach is tht the user has to send some input - * in order for the input-thread to wake up and realise it should kill itself. - * - * I tried writing to stdin/tty manually but for some reason rustty didn't - * acknowledge it. - */ - - /* - * tx sends to input-thread and it kills itself. - */ - context.input_kill(); - } - let mut f = create_temp_file(&new_draft(context), None); - //let mut f = Box::new(std::fs::File::create(&dir).unwrap()); - - // TODO: check exit status - let mut output = Command::new("vim") - .arg("+/^$") - .arg(&f.path()) - .stdin(Stdio::inherit()) - .stdout(Stdio::inherit()) - .spawn() - .expect("failed to execute process"); - - /* - * Main loop will wait on children and when they reap them the loop spawns a new - * input-thread - */ - context.replies.push_back(UIEvent { - id: 0, - event_type: UIEventType::Fork(ForkType::NewDraft(f, output)), - }); context.replies.push_back(UIEvent { id: 0, - event_type: UIEventType::ChangeMode(UIMode::Fork), + event_type: UIEventType::Action(Tab(NewDraft)), }); return true; } |