Support composing messages in an external editor (#155)

This commit is contained in:
Leonid Dyachkov 2023-09-10 16:45:27 +03:00 committed by Ulyssa
parent 47e650c2be
commit 0565b6eb05
No known key found for this signature in database
GPG key ID: F2873CA2997B83C5
6 changed files with 141 additions and 19 deletions

View file

@ -224,6 +224,9 @@ struct Application {
/// The tab layout before the last executed [TabAction].
last_layout: Option<TabLayoutDescription<IambInfo>>,
/// Whether we need to do a full redraw (e.g., after running a subprocess).
dirty: bool,
}
impl Application {
@ -263,6 +266,7 @@ impl Application {
screen,
focused: true,
last_layout: None,
dirty: true,
})
}
@ -314,7 +318,8 @@ impl Application {
async fn step(&mut self) -> Result<TerminalKey, std::io::Error> {
loop {
self.redraw(false, self.store.clone().lock().await.deref_mut())?;
self.redraw(self.dirty, self.store.clone().lock().await.deref_mut())?;
self.dirty = false;
if !poll(Duration::from_secs(1))? {
// Redraw in case there's new messages to show.
@ -479,6 +484,10 @@ impl Application {
ctx: ProgramContext,
store: &mut ProgramStore,
) -> IambResult<EditInfo> {
if action.scribbles() {
self.dirty = true;
}
let info = match action {
IambAction::ToggleScrollbackFocus => {
self.screen.current_window_mut()?.focus_toggle();