mirror of
https://github.com/gitui-org/gitui
synced 2026-05-23 17:08:21 +00:00
leave alternate screen when going into external editor (fixes #152)
This commit is contained in:
parent
80f98d6b6d
commit
ce4f3af767
1 changed files with 14 additions and 3 deletions
|
|
@ -2,11 +2,11 @@ use super::{
|
|||
textinput::TextInputComponent, visibility_blocking,
|
||||
CommandBlocking, CommandInfo, Component, DrawableComponent,
|
||||
};
|
||||
use crate::strings::COMMIT_EDITOR_MSG;
|
||||
use crate::{
|
||||
get_app_config_path, keys,
|
||||
queue::{InternalEvent, NeedsUpdate, Queue},
|
||||
strings,
|
||||
strings::COMMIT_EDITOR_MSG,
|
||||
ui::style::SharedTheme,
|
||||
};
|
||||
use anyhow::{anyhow, Result};
|
||||
|
|
@ -14,10 +14,15 @@ use asyncgit::{
|
|||
sync::{self, CommitId},
|
||||
CWD,
|
||||
};
|
||||
use crossterm::event::Event;
|
||||
use crossterm::{
|
||||
event::Event,
|
||||
terminal::{EnterAlternateScreen, LeaveAlternateScreen},
|
||||
ExecutableCommand,
|
||||
};
|
||||
use scopeguard::defer;
|
||||
use std::env;
|
||||
use std::fs::File;
|
||||
use std::io::{Read, Write};
|
||||
use std::io::{self, Read, Write};
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
use strings::commands;
|
||||
|
|
@ -150,6 +155,12 @@ impl CommitComponent {
|
|||
anyhow!("unable to read editor command")
|
||||
})?;
|
||||
|
||||
io::stdout().execute(LeaveAlternateScreen)?;
|
||||
|
||||
defer! {
|
||||
io::stdout().execute(EnterAlternateScreen).expect("failed to reset terminal");
|
||||
}
|
||||
|
||||
Command::new(command)
|
||||
.args(editor)
|
||||
.status()
|
||||
|
|
|
|||
Loading…
Reference in a new issue