gitui/src/queue.rs
Jon Grythe Stødle 52f31adb98 Add command to edit selected file in editor
Pressing `e` while looking at a file in the _Status_ view will launch an external editor with the current file opened. The editor chosen is determined by the default logic introduced in #114.

An improvement to this in the future could be launching at the specific line at which the _Diff_ view is focused, but that seems to require a change in `FileDiff` which is a change bigger than this PR.

Fixes #166
2020-07-07 12:42:01 +02:00

57 lines
1.2 KiB
Rust

use crate::tabs::StashingOptions;
use asyncgit::sync::CommitId;
use bitflags::bitflags;
use std::path::PathBuf;
use std::{cell::RefCell, collections::VecDeque, rc::Rc};
bitflags! {
/// flags defining what part of the app need to update
pub struct NeedsUpdate: u32 {
/// app::update
const ALL = 0b001;
/// diff may have changed (app::update_diff)
const DIFF = 0b010;
/// commands might need updating (app::update_commands)
const COMMANDS = 0b100;
}
}
/// data of item that is supposed to be reset
pub struct ResetItem {
/// path to the item (folder/file)
pub path: String,
/// are talking about a folder here? otherwise it's a single file
pub is_folder: bool,
}
///
pub enum Action {
Reset(ResetItem),
ResetHunk(String, u64),
StashDrop(CommitId),
}
///
pub enum InternalEvent {
///
ConfirmAction(Action),
///
ConfirmedAction(Action),
///
ShowErrorMsg(String),
///
Update(NeedsUpdate),
/// open commit msg input
OpenCommit,
///
PopupStashing(StashingOptions),
///
TabSwitch,
///
InspectCommit(CommitId),
///
OpenExternalEditor(Option<Box<PathBuf>>),
}
///
pub type Queue = Rc<RefCell<VecDeque<InternalEvent>>>;