diff options
author | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2020-11-23 18:11:02 +0200 |
---|---|---|
committer | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2020-11-24 02:18:21 +0200 |
commit | 179ed52addea7e6f43110143c55ad4aaaf16b9ba (patch) | |
tree | 80df0046d0c0c7e10fcbb4e36acd76c2d2a60812 | |
parent | ebc290cc2a10902f476251ef230b00681385b781 (diff) |
compose: grey embed area when embed is stopped
When stopping the embedded terminal with Ctrl-Z or SIGSTOP, show the
terminal area greyed out with a message box.
-rw-r--r-- | src/components/mail/compose.rs | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/src/components/mail/compose.rs b/src/components/mail/compose.rs index 06b42ac2..46b1e4e1 100644 --- a/src/components/mail/compose.rs +++ b/src/components/mail/compose.rs @@ -786,17 +786,41 @@ impl Component for Composer { return; } EmbedStatus::Stopped(_, _) => { - clear_area(grid, body_area, theme_default); + let guard = embed_pty.lock().unwrap(); + copy_area( + grid, + &guard.grid, + embed_area, + ((0, 0), pos_dec(guard.terminal_size, (1, 1))), + ); + change_colors(grid, embed_area, Color::Byte(8), theme_default.bg); + const STOPPED_MESSAGE: &str = "process has stopped, press 'e' to re-activate"; + let inner_area = create_box( + grid, + ( + pos_inc(upper_left!(body_area), (1, 0)), + pos_inc( + upper_left!(body_area), + ( + std::cmp::min(STOPPED_MESSAGE.len() + 5, width!(body_area)), + std::cmp::min(5, height!(body_area)), + ), + ), + ), + ); + clear_area(grid, inner_area, theme_default); write_string_to_grid( - "process has stopped, press 'e' to re-activate", + STOPPED_MESSAGE, grid, theme_default.fg, theme_default.bg, theme_default.attrs, - body_area, - None, + inner_area, + Some(get_x(upper_left!(inner_area))), ); context.dirty_areas.push_back(area); + self.dirty = false; + return; } } } else { |