mirror of
https://github.com/youwen5/iamb.git
synced 2025-06-19 21:29:52 -07:00
Support composing messages in an external editor (#155)
This commit is contained in:
parent
47e650c2be
commit
0565b6eb05
6 changed files with 141 additions and 19 deletions
11
src/main.rs
11
src/main.rs
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue