use crate::{
accessors,
cmdbar::CommandBar,
components::{
command_pump, event_pump, CommandInfo, Component,
DrawableComponent, FuzzyFinderTarget,
},
input::{Input, InputEvent, InputState},
keys::{key_match, KeyConfig, SharedKeyConfig},
options::{Options, SharedOptions},
popup_stack::PopupStack,
popups::{
AppOption, BlameFilePopup, BranchListPopup, CommitPopup,
CompareCommitsPopup, ConfirmPopup, CreateBranchPopup,
ExternalEditorPopup, FetchPopup, FileRevlogPopup,
FuzzyFindPopup, HelpPopup, InspectCommitPopup,
LogSearchPopupPopup, MsgPopup, OptionsPopup, PullPopup,
PushPopup, PushTagsPopup, RenameBranchPopup, ResetPopup,
RevisionFilesPopup, StashMsgPopup, SubmodulesListPopup,
TagCommitPopup, TagListPopup,
},
queue::{
Action, AppTabs, InternalEvent, NeedsUpdate, Queue,
StackablePopupOpen,
},
setup_popups,
strings::{self, ellipsis_trim_start, order},
tabs::{FilesTab, Revlog, StashList, Stashing, Status},
try_or_popup,
ui::style::{SharedTheme, Theme},
AsyncAppNotification, AsyncNotification,
};
use anyhow::{bail, Result};
use asyncgit::{
sync::{
self,
utils::{repo_work_dir, undo_last_commit},
RepoPath, RepoPathRef,
},
AsyncGitNotification, PushType,
};
use crossbeam_channel::Sender;
use crossterm::event::{Event, KeyEvent};
use ratatui::{
layout::{
Alignment, Constraint, Direction, Layout, Margin, Rect,
},
text::{Line, Span},
widgets::{Block, Borders, Paragraph, Tabs},
Frame,
};
use std::{
cell::{Cell, RefCell},
path::{Path, PathBuf},
rc::Rc,
};
use unicode_width::UnicodeWidthStr;
#[derive(Clone)]
pub enum QuitState {
None,
Close,
OpenSubmodule(RepoPath),
}
/// the main app type
pub struct App {
repo: RepoPathRef,
do_quit: QuitState,
help_popup: HelpPopup,
msg_popup: MsgPopup,
confirm_popup: ConfirmPopup,
commit_popup: CommitPopup,
blame_file_popup: BlameFilePopup,
file_revlog_popup: FileRevlogPopup,
stashmsg_popup: StashMsgPopup,
inspect_commit_popup: InspectCommitPopup,
compare_commits_popup: CompareCommitsPopup,
external_editor_popup: ExternalEditorPopup,
revision_files_popup: RevisionFilesPopup,
fuzzy_find_popup: FuzzyFindPopup,
log_search_popup: LogSearchPopupPopup,
push_popup: PushPopup,
push_tags_popup: PushTagsPopup,
pull_popup: PullPopup,
fetch_popup: FetchPopup,
tag_commit_popup: TagCommitPopup,
create_branch_popup: CreateBranchPopup,
rename_branch_popup: RenameBranchPopup,
select_branch_popup: BranchListPopup,
options_popup: OptionsPopup,
submodule_popup: SubmodulesListPopup,
tags_popup: TagListPopup,
reset_popup: ResetPopup,
cmdbar: RefCell<CommandBar