diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/app.rs | 19 |
1 files changed, 9 insertions, 10 deletions
@@ -272,16 +272,15 @@ impl<'ctx> AppState<'ctx> { | |||
272 | } | 272 | } |
273 | 273 | ||
274 | fn eval_command(&mut self) { | 274 | fn eval_command(&mut self) { |
275 | self.command_box.hist_append(); | 275 | if let Some(path) = self.command_box.text.strip_prefix("(save ") { |
276 | match self.command_box.text.as_str() { | 276 | let image = self.export(); |
277 | "(save)" => { | 277 | let encoded = image.encode().unwrap(); |
278 | let image = self.export(); | 278 | let mut buffer = File::create(path).unwrap(); |
279 | let encoded = image.encode().unwrap(); | 279 | eprintln!("writing to file"); |
280 | let mut buffer = File::create("test.obi").unwrap(); | 280 | buffer.write_all(&encoded[..]).unwrap(); |
281 | eprintln!("writing to file"); | 281 | self.command_box.hist_append(); |
282 | buffer.write_all(&encoded[..]).unwrap(); | 282 | } else { |
283 | } | 283 | eprintln!("cmd: {}", self.command_box.text); |
284 | _ => {} | ||
285 | } | 284 | } |
286 | self.command_box.clear(); | 285 | self.command_box.clear(); |
287 | self.mode = Mode::Draw; | 286 | self.mode = Mode::Draw; |