mirror of
https://github.com/gitui-org/gitui
synced 2026-05-23 17:08:21 +00:00
moving popups in its own module (#2066)
This commit is contained in:
parent
af9da95178
commit
e22cc70a7d
34 changed files with 364 additions and 352 deletions
154
src/app.rs
154
src/app.rs
|
|
@ -2,23 +2,23 @@ use crate::{
|
|||
accessors,
|
||||
cmdbar::CommandBar,
|
||||
components::{
|
||||
command_pump, event_pump, AppOption, BlameFileComponent,
|
||||
BranchListComponent, CommandInfo, CommitComponent,
|
||||
CompareCommitsComponent, Component, ConfirmComponent,
|
||||
CreateBranchComponent, DrawableComponent,
|
||||
ExternalEditorComponent, FetchComponent, FileRevlogComponent,
|
||||
FuzzyFindPopup, FuzzyFinderTarget, HelpComponent,
|
||||
InspectCommitComponent, LogSearchPopupComponent,
|
||||
MsgComponent, OptionsPopupComponent, PullComponent,
|
||||
PushComponent, PushTagsComponent, RenameBranchComponent,
|
||||
ResetPopupComponent, RevisionFilesPopup, StashMsgComponent,
|
||||
SubmodulesListComponent, TagCommitComponent,
|
||||
TagListComponent,
|
||||
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,
|
||||
|
|
@ -68,31 +68,31 @@ pub enum QuitState {
|
|||
pub struct App {
|
||||
repo: RepoPathRef,
|
||||
do_quit: QuitState,
|
||||
help: HelpComponent,
|
||||
msg: MsgComponent,
|
||||
reset: ConfirmComponent,
|
||||
commit: CommitComponent,
|
||||
blame_file_popup: BlameFileComponent,
|
||||
file_revlog_popup: FileRevlogComponent,
|
||||
stashmsg_popup: StashMsgComponent,
|
||||
inspect_commit_popup: InspectCommitComponent,
|
||||
compare_commits_popup: CompareCommitsComponent,
|
||||
external_editor_popup: ExternalEditorComponent,
|
||||
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: LogSearchPopupComponent,
|
||||
push_popup: PushComponent,
|
||||
push_tags_popup: PushTagsComponent,
|
||||
pull_popup: PullComponent,
|
||||
fetch_popup: FetchComponent,
|
||||
tag_commit_popup: TagCommitComponent,
|
||||
create_branch_popup: CreateBranchComponent,
|
||||
rename_branch_popup: RenameBranchComponent,
|
||||
select_branch_popup: BranchListComponent,
|
||||
options_popup: OptionsPopupComponent,
|
||||
submodule_popup: SubmodulesListComponent,
|
||||
tags_popup: TagListComponent,
|
||||
reset_popup: ResetPopupComponent,
|
||||
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>,
|
||||
tab: usize,
|
||||
revlog: Revlog,
|
||||
|
|
@ -171,39 +171,39 @@ impl App {
|
|||
|
||||
let mut app = Self {
|
||||
input,
|
||||
reset: ConfirmComponent::new(&env),
|
||||
commit: CommitComponent::new(&env),
|
||||
blame_file_popup: BlameFileComponent::new(
|
||||
confirm_popup: ConfirmPopup::new(&env),
|
||||
commit_popup: CommitPopup::new(&env),
|
||||
blame_file_popup: BlameFilePopup::new(
|
||||
&env,
|
||||
&strings::blame_title(&env.key_config),
|
||||
),
|
||||
file_revlog_popup: FileRevlogComponent::new(&env),
|
||||
file_revlog_popup: FileRevlogPopup::new(&env),
|
||||
revision_files_popup: RevisionFilesPopup::new(&env),
|
||||
stashmsg_popup: StashMsgComponent::new(&env),
|
||||
inspect_commit_popup: InspectCommitComponent::new(&env),
|
||||
compare_commits_popup: CompareCommitsComponent::new(&env),
|
||||
external_editor_popup: ExternalEditorComponent::new(&env),
|
||||
push_popup: PushComponent::new(&env),
|
||||
push_tags_popup: PushTagsComponent::new(&env),
|
||||
reset_popup: ResetPopupComponent::new(&env),
|
||||
pull_popup: PullComponent::new(&env),
|
||||
fetch_popup: FetchComponent::new(&env),
|
||||
tag_commit_popup: TagCommitComponent::new(&env),
|
||||
create_branch_popup: CreateBranchComponent::new(&env),
|
||||
rename_branch_popup: RenameBranchComponent::new(&env),
|
||||
select_branch_popup: BranchListComponent::new(&env),
|
||||
tags_popup: TagListComponent::new(&env),
|
||||
options_popup: OptionsPopupComponent::new(&env),
|
||||
submodule_popup: SubmodulesListComponent::new(&env),
|
||||
log_search_popup: LogSearchPopupComponent::new(&env),
|
||||
stashmsg_popup: StashMsgPopup::new(&env),
|
||||
inspect_commit_popup: InspectCommitPopup::new(&env),
|
||||
compare_commits_popup: CompareCommitsPopup::new(&env),
|
||||
external_editor_popup: ExternalEditorPopup::new(&env),
|
||||
push_popup: PushPopup::new(&env),
|
||||
push_tags_popup: PushTagsPopup::new(&env),
|
||||
reset_popup: ResetPopup::new(&env),
|
||||
pull_popup: PullPopup::new(&env),
|
||||
fetch_popup: FetchPopup::new(&env),
|
||||
tag_commit_popup: TagCommitPopup::new(&env),
|
||||
create_branch_popup: CreateBranchPopup::new(&env),
|
||||
rename_branch_popup: RenameBranchPopup::new(&env),
|
||||
select_branch_popup: BranchListPopup::new(&env),
|
||||
tags_popup: TagListPopup::new(&env),
|
||||
options_popup: OptionsPopup::new(&env),
|
||||
submodule_popup: SubmodulesListPopup::new(&env),
|
||||
log_search_popup: LogSearchPopupPopup::new(&env),
|
||||
fuzzy_find_popup: FuzzyFindPopup::new(&env),
|
||||
do_quit: QuitState::None,
|
||||
cmdbar: RefCell::new(CommandBar::new(
|
||||
env.theme.clone(),
|
||||
env.key_config.clone(),
|
||||
)),
|
||||
help: HelpComponent::new(&env),
|
||||
msg: MsgComponent::new(&env),
|
||||
help_popup: HelpPopup::new(&env),
|
||||
msg_popup: MsgPopup::new(&env),
|
||||
revlog: Revlog::new(&env),
|
||||
status_tab: Status::new(&env),
|
||||
stashing_tab: Stashing::new(&env),
|
||||
|
|
@ -345,21 +345,21 @@ impl App {
|
|||
if matches!(polling_state, InputState::Paused) {
|
||||
let result =
|
||||
if let Some(path) = self.file_to_open.take() {
|
||||
ExternalEditorComponent::open_file_in_editor(
|
||||
ExternalEditorPopup::open_file_in_editor(
|
||||
&self.repo.borrow(),
|
||||
Path::new(&path),
|
||||
)
|
||||
} else {
|
||||
let changes =
|
||||
self.status_tab.get_files_changes()?;
|
||||
self.commit.show_editor(changes)
|
||||
self.commit_popup.show_editor(changes)
|
||||
};
|
||||
|
||||
if let Err(e) = result {
|
||||
let msg =
|
||||
format!("failed to launch editor:\n{e}");
|
||||
log::error!("{}", msg.as_str());
|
||||
self.msg.show_error(msg.as_str())?;
|
||||
self.msg_popup.show_error(msg.as_str())?;
|
||||
}
|
||||
|
||||
self.requires_redraw.set(true);
|
||||
|
|
@ -375,7 +375,7 @@ impl App {
|
|||
pub fn update(&mut self) -> Result<()> {
|
||||
log::trace!("update");
|
||||
|
||||
self.commit.update();
|
||||
self.commit_popup.update();
|
||||
self.status_tab.update()?;
|
||||
self.revlog.update()?;
|
||||
self.files_tab.update()?;
|
||||
|
|
@ -469,9 +469,9 @@ impl App {
|
|||
[
|
||||
log_search_popup,
|
||||
fuzzy_find_popup,
|
||||
msg,
|
||||
reset,
|
||||
commit,
|
||||
msg_popup,
|
||||
confirm_popup,
|
||||
commit_popup,
|
||||
blame_file_popup,
|
||||
file_revlog_popup,
|
||||
stashmsg_popup,
|
||||
|
|
@ -491,7 +491,7 @@ impl App {
|
|||
tags_popup,
|
||||
reset_popup,
|
||||
options_popup,
|
||||
help,
|
||||
help_popup,
|
||||
revlog,
|
||||
status_tab,
|
||||
files_tab,
|
||||
|
|
@ -503,9 +503,9 @@ impl App {
|
|||
setup_popups!(
|
||||
self,
|
||||
[
|
||||
commit,
|
||||
commit_popup,
|
||||
stashmsg_popup,
|
||||
help,
|
||||
help_popup,
|
||||
inspect_commit_popup,
|
||||
compare_commits_popup,
|
||||
blame_file_popup,
|
||||
|
|
@ -526,8 +526,8 @@ impl App {
|
|||
pull_popup,
|
||||
fetch_popup,
|
||||
options_popup,
|
||||
reset,
|
||||
msg
|
||||
confirm_popup,
|
||||
msg_popup
|
||||
]
|
||||
);
|
||||
|
||||
|
|
@ -619,8 +619,8 @@ impl App {
|
|||
}
|
||||
|
||||
fn update_commands(&mut self) {
|
||||
if self.help.is_visible() {
|
||||
self.help.set_cmds(self.commands(true));
|
||||
if self.help_popup.is_visible() {
|
||||
self.help_popup.set_cmds(self.commands(true));
|
||||
}
|
||||
self.cmdbar.borrow_mut().set_cmds(self.commands(false));
|
||||
}
|
||||
|
|
@ -703,23 +703,23 @@ impl App {
|
|||
self.process_confirmed_action(action, &mut flags)?;
|
||||
}
|
||||
InternalEvent::ConfirmAction(action) => {
|
||||
self.reset.open(action)?;
|
||||
self.confirm_popup.open(action)?;
|
||||
flags.insert(NeedsUpdate::COMMANDS);
|
||||
}
|
||||
InternalEvent::ShowErrorMsg(msg) => {
|
||||
self.msg.show_error(msg.as_str())?;
|
||||
self.msg_popup.show_error(msg.as_str())?;
|
||||
flags
|
||||
.insert(NeedsUpdate::ALL | NeedsUpdate::COMMANDS);
|
||||
}
|
||||
InternalEvent::ShowInfoMsg(msg) => {
|
||||
self.msg.show_info(msg.as_str())?;
|
||||
self.msg_popup.show_info(msg.as_str())?;
|
||||
flags
|
||||
.insert(NeedsUpdate::ALL | NeedsUpdate::COMMANDS);
|
||||
}
|
||||
InternalEvent::Update(u) => flags.insert(u),
|
||||
InternalEvent::OpenCommit => self.commit.show()?,
|
||||
InternalEvent::OpenCommit => self.commit_popup.show()?,
|
||||
InternalEvent::RewordCommit(id) => {
|
||||
self.commit.open(Some(id))?;
|
||||
self.commit_popup.open(Some(id))?;
|
||||
}
|
||||
InternalEvent::PopupStashing(opts) => {
|
||||
self.stashmsg_popup.options(opts);
|
||||
|
|
|
|||
|
|
@ -1,75 +1,30 @@
|
|||
mod blame_file;
|
||||
mod branchlist;
|
||||
mod changes;
|
||||
mod command;
|
||||
mod commit;
|
||||
mod commit_details;
|
||||
mod commitlist;
|
||||
mod compare_commits;
|
||||
mod create_branch;
|
||||
mod cred;
|
||||
mod diff;
|
||||
mod externaleditor;
|
||||
mod fetch;
|
||||
mod file_revlog;
|
||||
mod fuzzy_find_popup;
|
||||
mod help;
|
||||
mod inspect_commit;
|
||||
mod log_search_popup;
|
||||
mod msg;
|
||||
mod options_popup;
|
||||
mod pull;
|
||||
mod push;
|
||||
mod push_tags;
|
||||
mod rename_branch;
|
||||
mod reset;
|
||||
mod reset_popup;
|
||||
mod revision_files;
|
||||
mod revision_files_popup;
|
||||
mod stashmsg;
|
||||
mod status_tree;
|
||||
mod submodules;
|
||||
mod syntax_text;
|
||||
mod tag_commit;
|
||||
mod taglist;
|
||||
mod textinput;
|
||||
mod utils;
|
||||
|
||||
pub use self::status_tree::StatusTreeComponent;
|
||||
pub use blame_file::{BlameFileComponent, BlameFileOpen};
|
||||
pub use branchlist::BranchListComponent;
|
||||
pub use changes::ChangesComponent;
|
||||
pub use command::{CommandInfo, CommandText};
|
||||
pub use commit::CommitComponent;
|
||||
pub use commit_details::CommitDetailsComponent;
|
||||
pub use commitlist::CommitList;
|
||||
pub use compare_commits::CompareCommitsComponent;
|
||||
pub use create_branch::CreateBranchComponent;
|
||||
pub use cred::CredComponent;
|
||||
pub use diff::DiffComponent;
|
||||
pub use externaleditor::ExternalEditorComponent;
|
||||
pub use fetch::FetchComponent;
|
||||
pub use file_revlog::{FileRevOpen, FileRevlogComponent};
|
||||
pub use fuzzy_find_popup::FuzzyFindPopup;
|
||||
pub use help::HelpComponent;
|
||||
pub use inspect_commit::{InspectCommitComponent, InspectCommitOpen};
|
||||
pub use log_search_popup::LogSearchPopupComponent;
|
||||
pub use msg::MsgComponent;
|
||||
pub use options_popup::{AppOption, OptionsPopupComponent};
|
||||
pub use pull::PullComponent;
|
||||
pub use push::PushComponent;
|
||||
pub use push_tags::PushTagsComponent;
|
||||
pub use rename_branch::RenameBranchComponent;
|
||||
pub use reset::ConfirmComponent;
|
||||
pub use reset_popup::ResetPopupComponent;
|
||||
pub use revision_files::RevisionFilesComponent;
|
||||
pub use revision_files_popup::{FileTreeOpen, RevisionFilesPopup};
|
||||
pub use stashmsg::StashMsgComponent;
|
||||
pub use submodules::SubmodulesListComponent;
|
||||
pub use syntax_text::SyntaxTextComponent;
|
||||
pub use tag_commit::TagCommitComponent;
|
||||
pub use taglist::TagListComponent;
|
||||
pub use textinput::{InputType, TextInputComponent};
|
||||
pub use utils::filetree::FileTreeItemKind;
|
||||
pub use utils::{
|
||||
filetree::FileTreeItemKind, logitems::ItemBatch,
|
||||
scroll_vertical::VerticalScroll, string_width_align,
|
||||
time_to_string,
|
||||
};
|
||||
|
||||
use crate::ui::style::Theme;
|
||||
use anyhow::Result;
|
||||
|
|
@ -78,7 +33,7 @@ use ratatui::{
|
|||
backend::Backend,
|
||||
layout::{Alignment, Rect},
|
||||
text::{Span, Text},
|
||||
widgets::{Block, BorderType, Borders, Paragraph, Wrap},
|
||||
widgets::{Block, Borders, Paragraph},
|
||||
Frame,
|
||||
};
|
||||
|
||||
|
|
@ -312,30 +267,3 @@ fn dialog_paragraph<'a>(
|
|||
)
|
||||
.alignment(Alignment::Left)
|
||||
}
|
||||
|
||||
fn popup_paragraph<'a, T>(
|
||||
title: &'a str,
|
||||
content: T,
|
||||
theme: &Theme,
|
||||
focused: bool,
|
||||
block: bool,
|
||||
) -> Paragraph<'a>
|
||||
where
|
||||
T: Into<Text<'a>>,
|
||||
{
|
||||
let paragraph = Paragraph::new(content.into())
|
||||
.alignment(Alignment::Left)
|
||||
.wrap(Wrap { trim: true });
|
||||
|
||||
if block {
|
||||
paragraph.block(
|
||||
Block::default()
|
||||
.title(Span::styled(title, theme.title(focused)))
|
||||
.borders(Borders::ALL)
|
||||
.border_type(BorderType::Thick)
|
||||
.border_style(theme.block(focused)),
|
||||
)
|
||||
} else {
|
||||
paragraph
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
use super::{
|
||||
utils::scroll_vertical::VerticalScroll, BlameFileOpen,
|
||||
CommandBlocking, CommandInfo, Component, DrawableComponent,
|
||||
EventState, FileRevOpen, FuzzyFinderTarget, SyntaxTextComponent,
|
||||
utils::scroll_vertical::VerticalScroll, CommandBlocking,
|
||||
CommandInfo, Component, DrawableComponent, EventState,
|
||||
FuzzyFinderTarget, SyntaxTextComponent,
|
||||
};
|
||||
use crate::{
|
||||
app::Environment,
|
||||
keys::{key_match, SharedKeyConfig},
|
||||
popups::{BlameFileOpen, FileRevOpen},
|
||||
queue::{InternalEvent, Queue, StackablePopupOpen},
|
||||
strings::{self, order, symbol},
|
||||
try_or_popup,
|
||||
|
|
|
|||
|
|
@ -3,16 +3,16 @@ use super::{
|
|||
filetree::{FileTreeItem, FileTreeItemKind},
|
||||
statustree::{MoveSelection, StatusTree},
|
||||
},
|
||||
BlameFileOpen, CommandBlocking, DrawableComponent, FileRevOpen,
|
||||
CommandBlocking, DrawableComponent,
|
||||
};
|
||||
use crate::{
|
||||
app::Environment,
|
||||
components::{CommandInfo, Component, EventState},
|
||||
keys::{key_match, SharedKeyConfig},
|
||||
popups::{BlameFileOpen, FileRevOpen},
|
||||
queue::{InternalEvent, NeedsUpdate, Queue, StackablePopupOpen},
|
||||
strings::{self, order},
|
||||
ui,
|
||||
ui::style::SharedTheme,
|
||||
ui::{self, style::SharedTheme},
|
||||
};
|
||||
use anyhow::Result;
|
||||
use asyncgit::{hash, sync::CommitId, StatusItem, StatusItemType};
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ mod keys;
|
|||
mod notify_mutex;
|
||||
mod options;
|
||||
mod popup_stack;
|
||||
mod popups;
|
||||
mod queue;
|
||||
mod spinner;
|
||||
mod string_utils;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
use super::{
|
||||
utils, visibility_blocking, CommandBlocking, CommandInfo,
|
||||
Component, DrawableComponent, EventState, FileRevOpen,
|
||||
InspectCommitOpen,
|
||||
};
|
||||
use crate::{
|
||||
app::Environment,
|
||||
components::{utils::string_width_align, ScrollType},
|
||||
components::{
|
||||
string_width_align, time_to_string, visibility_blocking,
|
||||
CommandBlocking, CommandInfo, Component, DrawableComponent,
|
||||
EventState, ScrollType,
|
||||
},
|
||||
keys::{key_match, SharedKeyConfig},
|
||||
popups::{FileRevOpen, InspectCommitOpen},
|
||||
queue::{InternalEvent, Queue, StackablePopupOpen},
|
||||
string_utils::tabs_to_spaces,
|
||||
strings,
|
||||
|
|
@ -84,7 +84,7 @@ pub struct BlameFileOpen {
|
|||
pub selection: Option<usize>,
|
||||
}
|
||||
|
||||
pub struct BlameFileComponent {
|
||||
pub struct BlameFilePopup {
|
||||
title: String,
|
||||
theme: SharedTheme,
|
||||
queue: Queue,
|
||||
|
|
@ -99,7 +99,7 @@ pub struct BlameFileComponent {
|
|||
git_sender: Sender<AsyncGitNotification>,
|
||||
repo: RepoPathRef,
|
||||
}
|
||||
impl DrawableComponent for BlameFileComponent {
|
||||
impl DrawableComponent for BlameFilePopup {
|
||||
fn draw<B: Backend>(
|
||||
&self,
|
||||
f: &mut Frame<B>,
|
||||
|
|
@ -192,7 +192,7 @@ impl DrawableComponent for BlameFileComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl Component for BlameFileComponent {
|
||||
impl Component for BlameFilePopup {
|
||||
fn commands(
|
||||
&self,
|
||||
out: &mut Vec<CommandInfo>,
|
||||
|
|
@ -329,7 +329,7 @@ impl Component for BlameFileComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl BlameFileComponent {
|
||||
impl BlameFilePopup {
|
||||
///
|
||||
pub fn new(env: &Environment, title: &str) -> Self {
|
||||
Self {
|
||||
|
|
@ -648,7 +648,7 @@ impl BlameFileComponent {
|
|||
);
|
||||
let author = format!("{truncated_author:MAX_AUTHOR_WIDTH$}");
|
||||
let time = blame_hunk.map_or_else(String::new, |hunk| {
|
||||
utils::time_to_string(hunk.time, true)
|
||||
time_to_string(hunk.time, true)
|
||||
});
|
||||
|
||||
let file_blame = self.blame.result();
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
use super::{
|
||||
utils::scroll_vertical::VerticalScroll, visibility_blocking,
|
||||
CommandBlocking, CommandInfo, Component, DrawableComponent,
|
||||
EventState, FuzzyFinderTarget, InspectCommitOpen,
|
||||
use crate::components::{
|
||||
visibility_blocking, CommandBlocking, CommandInfo, Component,
|
||||
DrawableComponent, EventState, FuzzyFinderTarget, VerticalScroll,
|
||||
};
|
||||
use crate::{
|
||||
app::Environment,
|
||||
|
|
@ -40,8 +39,10 @@ use std::cell::Cell;
|
|||
use ui::style::SharedTheme;
|
||||
use unicode_truncate::UnicodeTruncateStr;
|
||||
|
||||
use super::InspectCommitOpen;
|
||||
|
||||
///
|
||||
pub struct BranchListComponent {
|
||||
pub struct BranchListPopup {
|
||||
repo: RepoPathRef,
|
||||
branches: Vec<BranchInfo>,
|
||||
local: bool,
|
||||
|
|
@ -55,7 +56,7 @@ pub struct BranchListComponent {
|
|||
key_config: SharedKeyConfig,
|
||||
}
|
||||
|
||||
impl DrawableComponent for BranchListComponent {
|
||||
impl DrawableComponent for BranchListPopup {
|
||||
fn draw<B: Backend>(
|
||||
&self,
|
||||
f: &mut Frame<B>,
|
||||
|
|
@ -105,7 +106,7 @@ impl DrawableComponent for BranchListComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl Component for BranchListComponent {
|
||||
impl Component for BranchListPopup {
|
||||
fn commands(
|
||||
&self,
|
||||
out: &mut Vec<CommandInfo>,
|
||||
|
|
@ -329,7 +330,7 @@ impl Component for BranchListComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl BranchListComponent {
|
||||
impl BranchListPopup {
|
||||
pub fn new(env: &Environment) -> Self {
|
||||
Self {
|
||||
branches: Vec::new(),
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
use super::{
|
||||
textinput::TextInputComponent, visibility_blocking,
|
||||
CommandBlocking, CommandInfo, Component, DrawableComponent,
|
||||
EventState, ExternalEditorComponent,
|
||||
use crate::components::{
|
||||
visibility_blocking, CommandBlocking, CommandInfo, Component,
|
||||
DrawableComponent, EventState, TextInputComponent,
|
||||
};
|
||||
use crate::{
|
||||
app::Environment,
|
||||
|
|
@ -35,6 +34,8 @@ use std::{
|
|||
str::FromStr,
|
||||
};
|
||||
|
||||
use super::ExternalEditorPopup;
|
||||
|
||||
enum CommitResult {
|
||||
ComitDone,
|
||||
Aborted,
|
||||
|
|
@ -48,7 +49,7 @@ enum Mode {
|
|||
Reword(CommitId),
|
||||
}
|
||||
|
||||
pub struct CommitComponent {
|
||||
pub struct CommitPopup {
|
||||
repo: RepoPathRef,
|
||||
input: TextInputComponent,
|
||||
mode: Mode,
|
||||
|
|
@ -64,7 +65,7 @@ pub struct CommitComponent {
|
|||
|
||||
const FIRST_LINE_LIMIT: usize = 50;
|
||||
|
||||
impl CommitComponent {
|
||||
impl CommitPopup {
|
||||
///
|
||||
pub fn new(env: &Environment) -> Self {
|
||||
Self {
|
||||
|
|
@ -183,7 +184,7 @@ impl CommitComponent {
|
|||
}
|
||||
}
|
||||
|
||||
ExternalEditorComponent::open_file_in_editor(
|
||||
ExternalEditorPopup::open_file_in_editor(
|
||||
&self.repo.borrow(),
|
||||
&file_path,
|
||||
)?;
|
||||
|
|
@ -486,7 +487,7 @@ impl CommitComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl DrawableComponent for CommitComponent {
|
||||
impl DrawableComponent for CommitPopup {
|
||||
fn draw<B: Backend>(
|
||||
&self,
|
||||
f: &mut Frame<B>,
|
||||
|
|
@ -502,7 +503,7 @@ impl DrawableComponent for CommitComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl Component for CommitComponent {
|
||||
impl Component for CommitPopup {
|
||||
fn commands(
|
||||
&self,
|
||||
out: &mut Vec<CommandInfo>,
|
||||
|
|
@ -1,13 +1,14 @@
|
|||
use super::{
|
||||
use crate::components::{
|
||||
command_pump, event_pump, visibility_blocking, CommandBlocking,
|
||||
CommandInfo, CommitDetailsComponent, Component, DiffComponent,
|
||||
DrawableComponent, EventState, InspectCommitOpen,
|
||||
DrawableComponent, EventState,
|
||||
};
|
||||
use crate::{
|
||||
accessors,
|
||||
app::Environment,
|
||||
keys::{key_match, SharedKeyConfig},
|
||||
options::SharedOptions,
|
||||
popups::InspectCommitOpen,
|
||||
queue::{InternalEvent, Queue, StackablePopupOpen},
|
||||
strings,
|
||||
};
|
||||
|
|
@ -25,7 +26,7 @@ use ratatui::{
|
|||
Frame,
|
||||
};
|
||||
|
||||
pub struct CompareCommitsComponent {
|
||||
pub struct CompareCommitsPopup {
|
||||
repo: RepoPathRef,
|
||||
open_request: Option<InspectCommitOpen>,
|
||||
diff: DiffComponent,
|
||||
|
|
@ -37,7 +38,7 @@ pub struct CompareCommitsComponent {
|
|||
options: SharedOptions,
|
||||
}
|
||||
|
||||
impl DrawableComponent for CompareCommitsComponent {
|
||||
impl DrawableComponent for CompareCommitsPopup {
|
||||
fn draw<B: Backend>(
|
||||
&self,
|
||||
f: &mut Frame<B>,
|
||||
|
|
@ -71,7 +72,7 @@ impl DrawableComponent for CompareCommitsComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl Component for CompareCommitsComponent {
|
||||
impl Component for CompareCommitsPopup {
|
||||
fn commands(
|
||||
&self,
|
||||
out: &mut Vec<CommandInfo>,
|
||||
|
|
@ -163,7 +164,7 @@ impl Component for CompareCommitsComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl CompareCommitsComponent {
|
||||
impl CompareCommitsPopup {
|
||||
accessors!(self, [diff, details]);
|
||||
|
||||
///
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
use crate::{
|
||||
app::Environment,
|
||||
components::{
|
||||
popup_paragraph, visibility_blocking, CommandBlocking,
|
||||
CommandInfo, Component, DrawableComponent, EventState,
|
||||
visibility_blocking, CommandBlocking, CommandInfo, Component,
|
||||
DrawableComponent, EventState,
|
||||
},
|
||||
keys::{key_match, SharedKeyConfig},
|
||||
queue::{Action, InternalEvent, Queue},
|
||||
|
|
@ -16,8 +16,10 @@ use ratatui::{
|
|||
use std::borrow::Cow;
|
||||
use ui::style::SharedTheme;
|
||||
|
||||
use super::popup_paragraph;
|
||||
|
||||
///
|
||||
pub struct ConfirmComponent {
|
||||
pub struct ConfirmPopup {
|
||||
target: Option<Action>,
|
||||
visible: bool,
|
||||
queue: Queue,
|
||||
|
|
@ -25,7 +27,7 @@ pub struct ConfirmComponent {
|
|||
key_config: SharedKeyConfig,
|
||||
}
|
||||
|
||||
impl DrawableComponent for ConfirmComponent {
|
||||
impl DrawableComponent for ConfirmPopup {
|
||||
fn draw<B: Backend>(
|
||||
&self,
|
||||
f: &mut Frame<B>,
|
||||
|
|
@ -51,7 +53,7 @@ impl DrawableComponent for ConfirmComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl Component for ConfirmComponent {
|
||||
impl Component for ConfirmPopup {
|
||||
fn commands(
|
||||
&self,
|
||||
out: &mut Vec<CommandInfo>,
|
||||
|
|
@ -102,7 +104,7 @@ impl Component for ConfirmComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl ConfirmComponent {
|
||||
impl ConfirmPopup {
|
||||
///
|
||||
pub fn new(env: &Environment) -> Self {
|
||||
Self {
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
use super::{
|
||||
textinput::TextInputComponent, visibility_blocking,
|
||||
CommandBlocking, CommandInfo, Component, DrawableComponent,
|
||||
EventState,
|
||||
use crate::components::{
|
||||
visibility_blocking, CommandBlocking, CommandInfo, Component,
|
||||
DrawableComponent, EventState, InputType, TextInputComponent,
|
||||
};
|
||||
use crate::{
|
||||
app::Environment,
|
||||
|
|
@ -18,7 +17,7 @@ use ratatui::{
|
|||
backend::Backend, layout::Rect, widgets::Paragraph, Frame,
|
||||
};
|
||||
|
||||
pub struct CreateBranchComponent {
|
||||
pub struct CreateBranchPopup {
|
||||
repo: RepoPathRef,
|
||||
input: TextInputComponent,
|
||||
queue: Queue,
|
||||
|
|
@ -26,7 +25,7 @@ pub struct CreateBranchComponent {
|
|||
theme: SharedTheme,
|
||||
}
|
||||
|
||||
impl DrawableComponent for CreateBranchComponent {
|
||||
impl DrawableComponent for CreateBranchPopup {
|
||||
fn draw<B: Backend>(
|
||||
&self,
|
||||
f: &mut Frame<B>,
|
||||
|
|
@ -41,7 +40,7 @@ impl DrawableComponent for CreateBranchComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl Component for CreateBranchComponent {
|
||||
impl Component for CreateBranchPopup {
|
||||
fn commands(
|
||||
&self,
|
||||
out: &mut Vec<CommandInfo>,
|
||||
|
|
@ -94,7 +93,7 @@ impl Component for CreateBranchComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl CreateBranchComponent {
|
||||
impl CreateBranchPopup {
|
||||
///
|
||||
pub fn new(env: &Environment) -> Self {
|
||||
Self {
|
||||
|
|
@ -105,7 +104,7 @@ impl CreateBranchComponent {
|
|||
&strings::create_branch_popup_msg(&env.key_config),
|
||||
true,
|
||||
)
|
||||
.with_input_type(super::InputType::Singleline),
|
||||
.with_input_type(InputType::Singleline),
|
||||
theme: env.theme.clone(),
|
||||
key_config: env.key_config.clone(),
|
||||
repo: env.repo.clone(),
|
||||
|
|
@ -29,13 +29,13 @@ use std::ffi::OsStr;
|
|||
use std::{env, io, path::Path, process::Command};
|
||||
|
||||
///
|
||||
pub struct ExternalEditorComponent {
|
||||
pub struct ExternalEditorPopup {
|
||||
visible: bool,
|
||||
theme: SharedTheme,
|
||||
key_config: SharedKeyConfig,
|
||||
}
|
||||
|
||||
impl ExternalEditorComponent {
|
||||
impl ExternalEditorPopup {
|
||||
///
|
||||
pub fn new(env: &Environment) -> Self {
|
||||
Self {
|
||||
|
|
@ -120,7 +120,7 @@ impl ExternalEditorComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl DrawableComponent for ExternalEditorComponent {
|
||||
impl DrawableComponent for ExternalEditorPopup {
|
||||
fn draw<B: Backend>(
|
||||
&self,
|
||||
f: &mut Frame<B>,
|
||||
|
|
@ -155,7 +155,7 @@ impl DrawableComponent for ExternalEditorComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl Component for ExternalEditorComponent {
|
||||
impl Component for ExternalEditorPopup {
|
||||
fn commands(
|
||||
&self,
|
||||
out: &mut Vec<CommandInfo>,
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
use crate::{
|
||||
app::Environment,
|
||||
components::{
|
||||
cred::CredComponent, visibility_blocking, CommandBlocking,
|
||||
CommandInfo, Component, DrawableComponent, EventState,
|
||||
visibility_blocking, CommandBlocking, CommandInfo, Component,
|
||||
CredComponent, DrawableComponent, EventState,
|
||||
},
|
||||
keys::SharedKeyConfig,
|
||||
queue::{InternalEvent, NeedsUpdate, Queue},
|
||||
|
|
@ -32,7 +32,7 @@ use ratatui::{
|
|||
};
|
||||
|
||||
///
|
||||
pub struct FetchComponent {
|
||||
pub struct FetchPopup {
|
||||
repo: RepoPathRef,
|
||||
visible: bool,
|
||||
async_fetch: AsyncSingleJob<AsyncFetchJob>,
|
||||
|
|
@ -44,7 +44,7 @@ pub struct FetchComponent {
|
|||
input_cred: CredComponent,
|
||||
}
|
||||
|
||||
impl FetchComponent {
|
||||
impl FetchPopup {
|
||||
///
|
||||
pub fn new(env: &Environment) -> Self {
|
||||
Self {
|
||||
|
|
@ -116,7 +116,7 @@ impl FetchComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl DrawableComponent for FetchComponent {
|
||||
impl DrawableComponent for FetchPopup {
|
||||
fn draw<B: Backend>(
|
||||
&self,
|
||||
f: &mut Frame<B>,
|
||||
|
|
@ -151,7 +151,7 @@ impl DrawableComponent for FetchComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl Component for FetchComponent {
|
||||
impl Component for FetchPopup {
|
||||
fn commands(
|
||||
&self,
|
||||
out: &mut Vec<CommandInfo>,
|
||||
|
|
@ -1,16 +1,13 @@
|
|||
use super::utils::logitems::ItemBatch;
|
||||
use super::{visibility_blocking, BlameFileOpen, InspectCommitOpen};
|
||||
use crate::app::Environment;
|
||||
use crate::keys::key_match;
|
||||
use crate::options::SharedOptions;
|
||||
use crate::queue::StackablePopupOpen;
|
||||
use crate::{
|
||||
app::Environment,
|
||||
components::{
|
||||
event_pump, CommandBlocking, CommandInfo, Component,
|
||||
DiffComponent, DrawableComponent, EventState, ScrollType,
|
||||
event_pump, visibility_blocking, CommandBlocking,
|
||||
CommandInfo, Component, DiffComponent, DrawableComponent,
|
||||
EventState, ItemBatch, ScrollType,
|
||||
},
|
||||
keys::SharedKeyConfig,
|
||||
queue::{InternalEvent, NeedsUpdate, Queue},
|
||||
keys::{key_match, SharedKeyConfig},
|
||||
options::SharedOptions,
|
||||
queue::{InternalEvent, NeedsUpdate, Queue, StackablePopupOpen},
|
||||
strings,
|
||||
ui::{draw_scrollbar, style::SharedTheme, Orientation},
|
||||
};
|
||||
|
|
@ -32,6 +29,8 @@ use ratatui::{
|
|||
Frame,
|
||||
};
|
||||
|
||||
use super::{BlameFileOpen, InspectCommitOpen};
|
||||
|
||||
const SLICE_SIZE: usize = 1200;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
|
@ -50,7 +49,7 @@ impl FileRevOpen {
|
|||
}
|
||||
|
||||
///
|
||||
pub struct FileRevlogComponent {
|
||||
pub struct FileRevlogPopup {
|
||||
git_log: Option<AsyncLog>,
|
||||
git_diff: AsyncDiff,
|
||||
theme: SharedTheme,
|
||||
|
|
@ -69,7 +68,7 @@ pub struct FileRevlogComponent {
|
|||
current_height: std::cell::Cell<usize>,
|
||||
}
|
||||
|
||||
impl FileRevlogComponent {
|
||||
impl FileRevlogPopup {
|
||||
///
|
||||
pub fn new(env: &Environment) -> Self {
|
||||
Self {
|
||||
|
|
@ -464,7 +463,7 @@ impl FileRevlogComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl DrawableComponent for FileRevlogComponent {
|
||||
impl DrawableComponent for FileRevlogPopup {
|
||||
fn draw<B: Backend>(
|
||||
&self,
|
||||
f: &mut Frame<B>,
|
||||
|
|
@ -498,7 +497,7 @@ impl DrawableComponent for FileRevlogComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl Component for FileRevlogComponent {
|
||||
impl Component for FileRevlogPopup {
|
||||
fn event(&mut self, event: &Event) -> Result<EventState> {
|
||||
if self.is_visible() {
|
||||
if event_pump(
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
use super::{
|
||||
use crate::components::{
|
||||
visibility_blocking, CommandBlocking, CommandInfo, Component,
|
||||
DrawableComponent, EventState, FuzzyFinderTarget, ScrollType,
|
||||
TextInputComponent,
|
||||
DrawableComponent, EventState, FuzzyFinderTarget, InputType,
|
||||
ScrollType, TextInputComponent,
|
||||
};
|
||||
use crate::{
|
||||
app::Environment,
|
||||
|
|
@ -43,7 +43,7 @@ impl FuzzyFindPopup {
|
|||
pub fn new(env: &Environment) -> Self {
|
||||
let mut find_text =
|
||||
TextInputComponent::new(env, "", "start typing..", false)
|
||||
.with_input_type(super::InputType::Singleline);
|
||||
.with_input_type(InputType::Singleline);
|
||||
find_text.embed();
|
||||
|
||||
Self {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
use super::{
|
||||
use crate::components::{
|
||||
visibility_blocking, CommandBlocking, CommandInfo, Component,
|
||||
DrawableComponent, EventState,
|
||||
};
|
||||
|
|
@ -24,7 +24,7 @@ use std::{borrow::Cow, cmp};
|
|||
use ui::style::SharedTheme;
|
||||
|
||||
///
|
||||
pub struct HelpComponent {
|
||||
pub struct HelpPopup {
|
||||
cmds: Vec<CommandInfo>,
|
||||
visible: bool,
|
||||
selection: u16,
|
||||
|
|
@ -32,7 +32,7 @@ pub struct HelpComponent {
|
|||
key_config: SharedKeyConfig,
|
||||
}
|
||||
|
||||
impl DrawableComponent for HelpComponent {
|
||||
impl DrawableComponent for HelpPopup {
|
||||
fn draw<B: Backend>(
|
||||
&self,
|
||||
f: &mut Frame<B>,
|
||||
|
|
@ -87,7 +87,7 @@ impl DrawableComponent for HelpComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl Component for HelpComponent {
|
||||
impl Component for HelpPopup {
|
||||
fn commands(
|
||||
&self,
|
||||
out: &mut Vec<CommandInfo>,
|
||||
|
|
@ -167,7 +167,7 @@ impl Component for HelpComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl HelpComponent {
|
||||
impl HelpPopup {
|
||||
pub fn new(env: &Environment) -> Self {
|
||||
Self {
|
||||
cmds: vec![],
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
use super::{
|
||||
use crate::components::{
|
||||
command_pump, event_pump, visibility_blocking, CommandBlocking,
|
||||
CommandInfo, CommitDetailsComponent, Component, DiffComponent,
|
||||
DrawableComponent, EventState,
|
||||
|
|
@ -53,7 +53,7 @@ impl InspectCommitOpen {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct InspectCommitComponent {
|
||||
pub struct InspectCommitPopup {
|
||||
queue: Queue,
|
||||
open_request: Option<InspectCommitOpen>,
|
||||
diff: DiffComponent,
|
||||
|
|
@ -64,7 +64,7 @@ pub struct InspectCommitComponent {
|
|||
options: SharedOptions,
|
||||
}
|
||||
|
||||
impl DrawableComponent for InspectCommitComponent {
|
||||
impl DrawableComponent for InspectCommitPopup {
|
||||
fn draw<B: Backend>(
|
||||
&self,
|
||||
f: &mut Frame<B>,
|
||||
|
|
@ -98,7 +98,7 @@ impl DrawableComponent for InspectCommitComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl Component for InspectCommitComponent {
|
||||
impl Component for InspectCommitPopup {
|
||||
fn commands(
|
||||
&self,
|
||||
out: &mut Vec<CommandInfo>,
|
||||
|
|
@ -199,7 +199,7 @@ impl Component for InspectCommitComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl InspectCommitComponent {
|
||||
impl InspectCommitPopup {
|
||||
accessors!(self, [diff, details]);
|
||||
|
||||
///
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
use super::{
|
||||
use crate::components::{
|
||||
visibility_blocking, CommandBlocking, CommandInfo, Component,
|
||||
DrawableComponent, EventState, TextInputComponent,
|
||||
DrawableComponent, EventState, InputType, TextInputComponent,
|
||||
};
|
||||
use crate::{
|
||||
app::Environment,
|
||||
|
|
@ -41,7 +41,7 @@ enum PopupMode {
|
|||
JumpCommitSha,
|
||||
}
|
||||
|
||||
pub struct LogSearchPopupComponent {
|
||||
pub struct LogSearchPopupPopup {
|
||||
repo: RepoPathRef,
|
||||
queue: Queue,
|
||||
visible: bool,
|
||||
|
|
@ -54,12 +54,12 @@ pub struct LogSearchPopupComponent {
|
|||
jump_commit_id: Option<CommitId>,
|
||||
}
|
||||
|
||||
impl LogSearchPopupComponent {
|
||||
impl LogSearchPopupPopup {
|
||||
///
|
||||
pub fn new(env: &Environment) -> Self {
|
||||
let mut find_text =
|
||||
TextInputComponent::new(env, "", "search text", false)
|
||||
.with_input_type(super::InputType::Singleline);
|
||||
.with_input_type(InputType::Singleline);
|
||||
find_text.embed();
|
||||
find_text.enabled(true);
|
||||
|
||||
|
|
@ -524,7 +524,7 @@ impl LogSearchPopupComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl DrawableComponent for LogSearchPopupComponent {
|
||||
impl DrawableComponent for LogSearchPopupPopup {
|
||||
fn draw<B: Backend>(
|
||||
&self,
|
||||
f: &mut Frame<B>,
|
||||
|
|
@ -545,7 +545,7 @@ impl DrawableComponent for LogSearchPopupComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl Component for LogSearchPopupComponent {
|
||||
impl Component for LogSearchPopupPopup {
|
||||
fn commands(
|
||||
&self,
|
||||
out: &mut Vec<CommandInfo>,
|
||||
85
src/popups/mod.rs
Normal file
85
src/popups/mod.rs
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
mod blame_file;
|
||||
mod branchlist;
|
||||
mod commit;
|
||||
mod compare_commits;
|
||||
mod confirm;
|
||||
mod create_branch;
|
||||
mod externaleditor;
|
||||
mod fetch;
|
||||
mod file_revlog;
|
||||
mod fuzzy_find;
|
||||
mod help;
|
||||
mod inspect_commit;
|
||||
mod log_search;
|
||||
mod msg;
|
||||
mod options;
|
||||
mod pull;
|
||||
mod push;
|
||||
mod push_tags;
|
||||
mod rename_branch;
|
||||
mod reset;
|
||||
mod revision_files;
|
||||
mod stashmsg;
|
||||
mod submodules;
|
||||
mod tag_commit;
|
||||
mod taglist;
|
||||
|
||||
pub use blame_file::{BlameFileOpen, BlameFilePopup};
|
||||
pub use branchlist::BranchListPopup;
|
||||
pub use commit::CommitPopup;
|
||||
pub use compare_commits::CompareCommitsPopup;
|
||||
pub use confirm::ConfirmPopup;
|
||||
pub use create_branch::CreateBranchPopup;
|
||||
pub use externaleditor::ExternalEditorPopup;
|
||||
pub use fetch::FetchPopup;
|
||||
pub use file_revlog::{FileRevOpen, FileRevlogPopup};
|
||||
pub use fuzzy_find::FuzzyFindPopup;
|
||||
pub use help::HelpPopup;
|
||||
pub use inspect_commit::{InspectCommitOpen, InspectCommitPopup};
|
||||
pub use log_search::LogSearchPopupPopup;
|
||||
pub use msg::MsgPopup;
|
||||
pub use options::{AppOption, OptionsPopup};
|
||||
pub use pull::PullPopup;
|
||||
pub use push::PushPopup;
|
||||
pub use push_tags::PushTagsPopup;
|
||||
pub use rename_branch::RenameBranchPopup;
|
||||
pub use reset::ResetPopup;
|
||||
pub use revision_files::{FileTreeOpen, RevisionFilesPopup};
|
||||
pub use stashmsg::StashMsgPopup;
|
||||
pub use submodules::SubmodulesListPopup;
|
||||
pub use tag_commit::TagCommitPopup;
|
||||
pub use taglist::TagListPopup;
|
||||
|
||||
use crate::ui::style::Theme;
|
||||
use ratatui::{
|
||||
layout::Alignment,
|
||||
text::{Span, Text},
|
||||
widgets::{Block, BorderType, Borders, Paragraph, Wrap},
|
||||
};
|
||||
|
||||
fn popup_paragraph<'a, T>(
|
||||
title: &'a str,
|
||||
content: T,
|
||||
theme: &Theme,
|
||||
focused: bool,
|
||||
block: bool,
|
||||
) -> Paragraph<'a>
|
||||
where
|
||||
T: Into<Text<'a>>,
|
||||
{
|
||||
let paragraph = Paragraph::new(content.into())
|
||||
.alignment(Alignment::Left)
|
||||
.wrap(Wrap { trim: true });
|
||||
|
||||
if block {
|
||||
paragraph.block(
|
||||
Block::default()
|
||||
.title(Span::styled(title, theme.title(focused)))
|
||||
.borders(Borders::ALL)
|
||||
.border_type(BorderType::Thick)
|
||||
.border_style(theme.block(focused)),
|
||||
)
|
||||
} else {
|
||||
paragraph
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
use super::{
|
||||
use crate::components::{
|
||||
visibility_blocking, CommandBlocking, CommandInfo, Component,
|
||||
DrawableComponent, EventState,
|
||||
};
|
||||
|
|
@ -17,7 +17,7 @@ use ratatui::{
|
|||
};
|
||||
use ui::style::SharedTheme;
|
||||
|
||||
pub struct MsgComponent {
|
||||
pub struct MsgPopup {
|
||||
title: String,
|
||||
msg: String,
|
||||
visible: bool,
|
||||
|
|
@ -27,7 +27,7 @@ pub struct MsgComponent {
|
|||
|
||||
use anyhow::Result;
|
||||
|
||||
impl DrawableComponent for MsgComponent {
|
||||
impl DrawableComponent for MsgPopup {
|
||||
fn draw<B: Backend>(
|
||||
&self,
|
||||
f: &mut Frame<B>,
|
||||
|
|
@ -78,7 +78,7 @@ impl DrawableComponent for MsgComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl Component for MsgComponent {
|
||||
impl Component for MsgPopup {
|
||||
fn commands(
|
||||
&self,
|
||||
out: &mut Vec<CommandInfo>,
|
||||
|
|
@ -121,7 +121,7 @@ impl Component for MsgComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl MsgComponent {
|
||||
impl MsgPopup {
|
||||
pub fn new(env: &Environment) -> Self {
|
||||
Self {
|
||||
title: String::new(),
|
||||
|
|
@ -1,14 +1,13 @@
|
|||
use super::{
|
||||
visibility_blocking, CommandBlocking, CommandInfo, Component,
|
||||
DrawableComponent, EventState,
|
||||
};
|
||||
use crate::{
|
||||
app::Environment,
|
||||
components::utils::string_width_align,
|
||||
components::{
|
||||
string_width_align, visibility_blocking, CommandBlocking,
|
||||
CommandInfo, Component, DrawableComponent, EventState,
|
||||
},
|
||||
keys::{key_match, SharedKeyConfig},
|
||||
options::SharedOptions,
|
||||
queue::{InternalEvent, Queue},
|
||||
strings::{self},
|
||||
strings,
|
||||
ui::{self, style::SharedTheme},
|
||||
};
|
||||
use anyhow::Result;
|
||||
|
|
@ -31,7 +30,7 @@ pub enum AppOption {
|
|||
DiffInterhunkLines,
|
||||
}
|
||||
|
||||
pub struct OptionsPopupComponent {
|
||||
pub struct OptionsPopup {
|
||||
selection: AppOption,
|
||||
queue: Queue,
|
||||
visible: bool,
|
||||
|
|
@ -40,7 +39,7 @@ pub struct OptionsPopupComponent {
|
|||
theme: SharedTheme,
|
||||
}
|
||||
|
||||
impl OptionsPopupComponent {
|
||||
impl OptionsPopup {
|
||||
///
|
||||
pub fn new(env: &Environment) -> Self {
|
||||
Self {
|
||||
|
|
@ -256,7 +255,7 @@ impl OptionsPopupComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl DrawableComponent for OptionsPopupComponent {
|
||||
impl DrawableComponent for OptionsPopup {
|
||||
fn draw<B: Backend>(
|
||||
&self,
|
||||
f: &mut Frame<B>,
|
||||
|
|
@ -290,7 +289,7 @@ impl DrawableComponent for OptionsPopupComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl Component for OptionsPopupComponent {
|
||||
impl Component for OptionsPopup {
|
||||
fn commands(
|
||||
&self,
|
||||
out: &mut Vec<CommandInfo>,
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
use super::PushComponent;
|
||||
use crate::{
|
||||
app::Environment,
|
||||
components::{
|
||||
cred::CredComponent, visibility_blocking, CommandBlocking,
|
||||
CommandInfo, Component, DrawableComponent, EventState,
|
||||
visibility_blocking, CommandBlocking, CommandInfo, Component,
|
||||
CredComponent, DrawableComponent, EventState,
|
||||
},
|
||||
keys::SharedKeyConfig,
|
||||
popups::PushPopup,
|
||||
queue::{Action, InternalEvent, Queue},
|
||||
strings, try_or_popup,
|
||||
ui::{self, style::SharedTheme},
|
||||
|
|
@ -33,7 +33,7 @@ use ratatui::{
|
|||
};
|
||||
|
||||
///
|
||||
pub struct PullComponent {
|
||||
pub struct PullPopup {
|
||||
repo: RepoPathRef,
|
||||
visible: bool,
|
||||
git_fetch: AsyncPull,
|
||||
|
|
@ -46,7 +46,7 @@ pub struct PullComponent {
|
|||
input_cred: CredComponent,
|
||||
}
|
||||
|
||||
impl PullComponent {
|
||||
impl PullPopup {
|
||||
///
|
||||
pub fn new(env: &Environment) -> Self {
|
||||
Self {
|
||||
|
|
@ -197,7 +197,7 @@ impl PullComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl DrawableComponent for PullComponent {
|
||||
impl DrawableComponent for PullPopup {
|
||||
fn draw<B: Backend>(
|
||||
&self,
|
||||
f: &mut Frame<B>,
|
||||
|
|
@ -205,7 +205,7 @@ impl DrawableComponent for PullComponent {
|
|||
) -> Result<()> {
|
||||
if self.visible {
|
||||
let (state, progress) =
|
||||
PushComponent::get_progress(&self.progress);
|
||||
PushPopup::get_progress(&self.progress);
|
||||
|
||||
let area = ui::centered_rect_absolute(30, 3, f.size());
|
||||
|
||||
|
|
@ -234,7 +234,7 @@ impl DrawableComponent for PullComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl Component for PullComponent {
|
||||
impl Component for PullPopup {
|
||||
fn commands(
|
||||
&self,
|
||||
out: &mut Vec<CommandInfo>,
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
use crate::{
|
||||
app::Environment,
|
||||
components::{
|
||||
cred::CredComponent, visibility_blocking, CommandBlocking,
|
||||
CommandInfo, Component, DrawableComponent, EventState,
|
||||
visibility_blocking, CommandBlocking, CommandInfo, Component,
|
||||
CredComponent, DrawableComponent, EventState,
|
||||
},
|
||||
keys::{key_match, SharedKeyConfig},
|
||||
queue::{InternalEvent, Queue},
|
||||
|
|
@ -49,7 +49,7 @@ impl PushComponentModifier {
|
|||
}
|
||||
|
||||
///
|
||||
pub struct PushComponent {
|
||||
pub struct PushPopup {
|
||||
repo: RepoPathRef,
|
||||
modifier: PushComponentModifier,
|
||||
visible: bool,
|
||||
|
|
@ -64,7 +64,7 @@ pub struct PushComponent {
|
|||
input_cred: CredComponent,
|
||||
}
|
||||
|
||||
impl PushComponent {
|
||||
impl PushPopup {
|
||||
///
|
||||
pub fn new(env: &Environment) -> Self {
|
||||
Self {
|
||||
|
|
@ -226,7 +226,7 @@ impl PushComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl DrawableComponent for PushComponent {
|
||||
impl DrawableComponent for PushPopup {
|
||||
fn draw<B: Backend>(
|
||||
&self,
|
||||
f: &mut Frame<B>,
|
||||
|
|
@ -267,7 +267,7 @@ impl DrawableComponent for PushComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl Component for PushComponent {
|
||||
impl Component for PushPopup {
|
||||
fn commands(
|
||||
&self,
|
||||
out: &mut Vec<CommandInfo>,
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
use crate::{
|
||||
app::Environment,
|
||||
components::{
|
||||
cred::CredComponent, visibility_blocking, CommandBlocking,
|
||||
CommandInfo, Component, DrawableComponent, EventState,
|
||||
visibility_blocking, CommandBlocking, CommandInfo, Component,
|
||||
CredComponent, DrawableComponent, EventState,
|
||||
},
|
||||
keys::{key_match, SharedKeyConfig},
|
||||
queue::{InternalEvent, Queue},
|
||||
strings::{self},
|
||||
strings,
|
||||
ui::{self, style::SharedTheme},
|
||||
};
|
||||
use anyhow::Result;
|
||||
|
|
@ -31,7 +31,7 @@ use ratatui::{
|
|||
};
|
||||
|
||||
///
|
||||
pub struct PushTagsComponent {
|
||||
pub struct PushTagsPopup {
|
||||
repo: RepoPathRef,
|
||||
visible: bool,
|
||||
git_push: AsyncPushTags,
|
||||
|
|
@ -43,7 +43,7 @@ pub struct PushTagsComponent {
|
|||
input_cred: CredComponent,
|
||||
}
|
||||
|
||||
impl PushTagsComponent {
|
||||
impl PushTagsPopup {
|
||||
///
|
||||
pub fn new(env: &Environment) -> Self {
|
||||
Self {
|
||||
|
|
@ -157,7 +157,7 @@ impl PushTagsComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl DrawableComponent for PushTagsComponent {
|
||||
impl DrawableComponent for PushTagsPopup {
|
||||
fn draw<B: Backend>(
|
||||
&self,
|
||||
f: &mut Frame<B>,
|
||||
|
|
@ -194,7 +194,7 @@ impl DrawableComponent for PushTagsComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl Component for PushTagsComponent {
|
||||
impl Component for PushTagsPopup {
|
||||
fn commands(
|
||||
&self,
|
||||
out: &mut Vec<CommandInfo>,
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
use super::{
|
||||
textinput::TextInputComponent, visibility_blocking,
|
||||
CommandBlocking, CommandInfo, Component, DrawableComponent,
|
||||
EventState,
|
||||
use crate::components::{
|
||||
visibility_blocking, CommandBlocking, CommandInfo, Component,
|
||||
DrawableComponent, EventState, InputType, TextInputComponent,
|
||||
};
|
||||
use crate::{
|
||||
app::Environment,
|
||||
|
|
@ -14,7 +13,7 @@ use asyncgit::sync::{self, RepoPathRef};
|
|||
use crossterm::event::Event;
|
||||
use ratatui::{backend::Backend, layout::Rect, Frame};
|
||||
|
||||
pub struct RenameBranchComponent {
|
||||
pub struct RenameBranchPopup {
|
||||
repo: RepoPathRef,
|
||||
input: TextInputComponent,
|
||||
branch_ref: Option<String>,
|
||||
|
|
@ -22,7 +21,7 @@ pub struct RenameBranchComponent {
|
|||
key_config: SharedKeyConfig,
|
||||
}
|
||||
|
||||
impl DrawableComponent for RenameBranchComponent {
|
||||
impl DrawableComponent for RenameBranchPopup {
|
||||
fn draw<B: Backend>(
|
||||
&self,
|
||||
f: &mut Frame<B>,
|
||||
|
|
@ -34,7 +33,7 @@ impl DrawableComponent for RenameBranchComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl Component for RenameBranchComponent {
|
||||
impl Component for RenameBranchPopup {
|
||||
fn commands(
|
||||
&self,
|
||||
out: &mut Vec<CommandInfo>,
|
||||
|
|
@ -87,7 +86,7 @@ impl Component for RenameBranchComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl RenameBranchComponent {
|
||||
impl RenameBranchPopup {
|
||||
///
|
||||
pub fn new(env: &Environment) -> Self {
|
||||
Self {
|
||||
|
|
@ -99,7 +98,7 @@ impl RenameBranchComponent {
|
|||
&strings::rename_branch_popup_msg(&env.key_config),
|
||||
true,
|
||||
)
|
||||
.with_input_type(super::InputType::Singleline),
|
||||
.with_input_type(InputType::Singleline),
|
||||
branch_ref: None,
|
||||
key_config: env.key_config.clone(),
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
use super::{
|
||||
use crate::components::{
|
||||
visibility_blocking, CommandBlocking, CommandInfo, Component,
|
||||
DrawableComponent, EventState,
|
||||
};
|
||||
|
|
@ -40,7 +40,7 @@ const fn type_to_string(
|
|||
}
|
||||
}
|
||||
|
||||
pub struct ResetPopupComponent {
|
||||
pub struct ResetPopup {
|
||||
queue: Queue,
|
||||
repo: RepoPath,
|
||||
commit: Option<CommitId>,
|
||||
|
|
@ -51,7 +51,7 @@ pub struct ResetPopupComponent {
|
|||
theme: SharedTheme,
|
||||
}
|
||||
|
||||
impl ResetPopupComponent {
|
||||
impl ResetPopup {
|
||||
///
|
||||
pub fn new(env: &Environment) -> Self {
|
||||
Self {
|
||||
|
|
@ -155,7 +155,7 @@ impl ResetPopupComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl DrawableComponent for ResetPopupComponent {
|
||||
impl DrawableComponent for ResetPopup {
|
||||
fn draw<B: Backend>(
|
||||
&self,
|
||||
f: &mut Frame<B>,
|
||||
|
|
@ -189,7 +189,7 @@ impl DrawableComponent for ResetPopupComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl Component for ResetPopupComponent {
|
||||
impl Component for ResetPopup {
|
||||
fn commands(
|
||||
&self,
|
||||
out: &mut Vec<CommandInfo>,
|
||||
|
|
@ -1,9 +1,6 @@
|
|||
use std::path::Path;
|
||||
|
||||
use super::{
|
||||
revision_files::RevisionFilesComponent, visibility_blocking,
|
||||
CommandBlocking, CommandInfo, Component, DrawableComponent,
|
||||
EventState,
|
||||
use crate::components::{
|
||||
visibility_blocking, CommandBlocking, CommandInfo, Component,
|
||||
DrawableComponent, EventState, RevisionFilesComponent,
|
||||
};
|
||||
use crate::{
|
||||
app::Environment,
|
||||
|
|
@ -18,6 +15,7 @@ use crossterm::event::Event;
|
|||
use ratatui::{
|
||||
backend::Backend, layout::Rect, widgets::Clear, Frame,
|
||||
};
|
||||
use std::path::Path;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct FileTreeOpen {
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
use super::{
|
||||
textinput::TextInputComponent, visibility_blocking,
|
||||
CommandBlocking, CommandInfo, Component, DrawableComponent,
|
||||
EventState,
|
||||
use crate::components::{
|
||||
visibility_blocking, CommandBlocking, CommandInfo, Component,
|
||||
DrawableComponent, EventState, InputType, TextInputComponent,
|
||||
};
|
||||
use crate::{
|
||||
app::Environment,
|
||||
|
|
@ -15,7 +14,7 @@ use asyncgit::sync::{self, RepoPathRef};
|
|||
use crossterm::event::Event;
|
||||
use ratatui::{backend::Backend, layout::Rect, Frame};
|
||||
|
||||
pub struct StashMsgComponent {
|
||||
pub struct StashMsgPopup {
|
||||
repo: RepoPathRef,
|
||||
options: StashingOptions,
|
||||
input: TextInputComponent,
|
||||
|
|
@ -23,7 +22,7 @@ pub struct StashMsgComponent {
|
|||
key_config: SharedKeyConfig,
|
||||
}
|
||||
|
||||
impl DrawableComponent for StashMsgComponent {
|
||||
impl DrawableComponent for StashMsgPopup {
|
||||
fn draw<B: Backend>(
|
||||
&self,
|
||||
f: &mut Frame<B>,
|
||||
|
|
@ -35,7 +34,7 @@ impl DrawableComponent for StashMsgComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl Component for StashMsgComponent {
|
||||
impl Component for StashMsgPopup {
|
||||
fn commands(
|
||||
&self,
|
||||
out: &mut Vec<CommandInfo>,
|
||||
|
|
@ -124,7 +123,7 @@ impl Component for StashMsgComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl StashMsgComponent {
|
||||
impl StashMsgPopup {
|
||||
///
|
||||
pub fn new(env: &Environment) -> Self {
|
||||
Self {
|
||||
|
|
@ -136,7 +135,7 @@ impl StashMsgComponent {
|
|||
&strings::stash_popup_msg(&env.key_config),
|
||||
true,
|
||||
)
|
||||
.with_input_type(super::InputType::Singleline),
|
||||
.with_input_type(InputType::Singleline),
|
||||
key_config: env.key_config.clone(),
|
||||
repo: env.repo.clone(),
|
||||
}
|
||||
|
|
@ -1,10 +1,9 @@
|
|||
use super::{
|
||||
utils::scroll_vertical::VerticalScroll, visibility_blocking,
|
||||
CommandBlocking, CommandInfo, Component, DrawableComponent,
|
||||
EventState, ScrollType,
|
||||
};
|
||||
use crate::{
|
||||
app::Environment,
|
||||
components::{
|
||||
visibility_blocking, CommandBlocking, CommandInfo, Component,
|
||||
DrawableComponent, EventState, ScrollType, VerticalScroll,
|
||||
},
|
||||
keys::{key_match, SharedKeyConfig},
|
||||
queue::{InternalEvent, NeedsUpdate, Queue},
|
||||
strings, try_or_popup,
|
||||
|
|
@ -31,7 +30,7 @@ use ui::style::SharedTheme;
|
|||
use unicode_truncate::UnicodeTruncateStr;
|
||||
|
||||
///
|
||||
pub struct SubmodulesListComponent {
|
||||
pub struct SubmodulesListPopup {
|
||||
repo: RepoPathRef,
|
||||
repo_path: String,
|
||||
queue: Queue,
|
||||
|
|
@ -45,7 +44,7 @@ pub struct SubmodulesListComponent {
|
|||
key_config: SharedKeyConfig,
|
||||
}
|
||||
|
||||
impl DrawableComponent for SubmodulesListComponent {
|
||||
impl DrawableComponent for SubmodulesListPopup {
|
||||
fn draw<B: Backend>(
|
||||
&self,
|
||||
f: &mut Frame<B>,
|
||||
|
|
@ -103,7 +102,7 @@ impl DrawableComponent for SubmodulesListComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl Component for SubmodulesListComponent {
|
||||
impl Component for SubmodulesListPopup {
|
||||
fn commands(
|
||||
&self,
|
||||
out: &mut Vec<CommandInfo>,
|
||||
|
|
@ -245,7 +244,7 @@ impl Component for SubmodulesListComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl SubmodulesListComponent {
|
||||
impl SubmodulesListPopup {
|
||||
pub fn new(env: &Environment) -> Self {
|
||||
Self {
|
||||
submodules: Vec::new(),
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
use super::{
|
||||
textinput::TextInputComponent, visibility_blocking,
|
||||
CommandBlocking, CommandInfo, Component, DrawableComponent,
|
||||
EventState,
|
||||
use crate::components::{
|
||||
visibility_blocking, CommandBlocking, CommandInfo, Component,
|
||||
DrawableComponent, EventState, InputType, TextInputComponent,
|
||||
};
|
||||
use crate::{
|
||||
app::Environment,
|
||||
|
|
@ -21,7 +20,7 @@ enum Mode {
|
|||
Annotation { tag_name: String },
|
||||
}
|
||||
|
||||
pub struct TagCommitComponent {
|
||||
pub struct TagCommitPopup {
|
||||
repo: RepoPathRef,
|
||||
mode: Mode,
|
||||
input: TextInputComponent,
|
||||
|
|
@ -30,7 +29,7 @@ pub struct TagCommitComponent {
|
|||
key_config: SharedKeyConfig,
|
||||
}
|
||||
|
||||
impl DrawableComponent for TagCommitComponent {
|
||||
impl DrawableComponent for TagCommitPopup {
|
||||
fn draw<B: Backend>(
|
||||
&self,
|
||||
f: &mut Frame<B>,
|
||||
|
|
@ -42,7 +41,7 @@ impl DrawableComponent for TagCommitComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl Component for TagCommitComponent {
|
||||
impl Component for TagCommitPopup {
|
||||
fn commands(
|
||||
&self,
|
||||
out: &mut Vec<CommandInfo>,
|
||||
|
|
@ -124,7 +123,7 @@ impl Component for TagCommitComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl TagCommitComponent {
|
||||
impl TagCommitPopup {
|
||||
///
|
||||
pub fn new(env: &Environment) -> Self {
|
||||
Self {
|
||||
|
|
@ -135,7 +134,7 @@ impl TagCommitComponent {
|
|||
&strings::tag_popup_name_msg(),
|
||||
true,
|
||||
)
|
||||
.with_input_type(super::InputType::Singleline),
|
||||
.with_input_type(InputType::Singleline),
|
||||
commit_id: None,
|
||||
key_config: env.key_config.clone(),
|
||||
repo: env.repo.clone(),
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
use super::{
|
||||
utils, visibility_blocking, CommandBlocking, CommandInfo,
|
||||
Component, DrawableComponent, EventState,
|
||||
use crate::components::{
|
||||
time_to_string, visibility_blocking, CommandBlocking,
|
||||
CommandInfo, Component, DrawableComponent, EventState,
|
||||
};
|
||||
use crate::{
|
||||
app::Environment,
|
||||
|
|
@ -39,7 +39,7 @@ use ratatui::{
|
|||
use ui::style::SharedTheme;
|
||||
|
||||
///
|
||||
pub struct TagListComponent {
|
||||
pub struct TagListPopup {
|
||||
repo: RepoPathRef,
|
||||
theme: SharedTheme,
|
||||
queue: Queue,
|
||||
|
|
@ -54,7 +54,7 @@ pub struct TagListComponent {
|
|||
key_config: SharedKeyConfig,
|
||||
}
|
||||
|
||||
impl DrawableComponent for TagListComponent {
|
||||
impl DrawableComponent for TagListPopup {
|
||||
fn draw<B: Backend>(
|
||||
&self,
|
||||
f: &mut Frame<B>,
|
||||
|
|
@ -139,7 +139,7 @@ impl DrawableComponent for TagListComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl Component for TagListComponent {
|
||||
impl Component for TagListPopup {
|
||||
fn commands(
|
||||
&self,
|
||||
out: &mut Vec<CommandInfo>,
|
||||
|
|
@ -291,7 +291,7 @@ impl Component for TagListComponent {
|
|||
}
|
||||
}
|
||||
|
||||
impl TagListComponent {
|
||||
impl TagListPopup {
|
||||
pub fn new(env: &Environment) -> Self {
|
||||
Self {
|
||||
theme: env.theme.clone(),
|
||||
|
|
@ -477,7 +477,7 @@ impl TagListComponent {
|
|||
.style(self.theme.commit_author(false)),
|
||||
Cell::from(tag.name.clone())
|
||||
.style(self.theme.text(true, false)),
|
||||
Cell::from(utils::time_to_string(tag.time, true))
|
||||
Cell::from(time_to_string(tag.time, true))
|
||||
.style(self.theme.commit_time(false)),
|
||||
Cell::from(tag.author.clone())
|
||||
.style(self.theme.commit_author(false)),
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
use crate::{
|
||||
components::{
|
||||
components::FuzzyFinderTarget,
|
||||
popups::{
|
||||
AppOption, BlameFileOpen, FileRevOpen, FileTreeOpen,
|
||||
FuzzyFinderTarget, InspectCommitOpen,
|
||||
InspectCommitOpen,
|
||||
},
|
||||
tabs::StashingOptions,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@ use crate::{
|
|||
components::{
|
||||
visibility_blocking, CommandBlocking, CommandInfo,
|
||||
CommitDetailsComponent, CommitList, Component,
|
||||
DrawableComponent, EventState, FileTreeOpen,
|
||||
InspectCommitOpen,
|
||||
DrawableComponent, EventState,
|
||||
},
|
||||
keys::{key_match, SharedKeyConfig},
|
||||
popups::{FileTreeOpen, InspectCommitOpen},
|
||||
queue::{InternalEvent, Queue, StackablePopupOpen},
|
||||
strings::{self, order},
|
||||
try_or_popup,
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ use crate::{
|
|||
components::{
|
||||
visibility_blocking, CommandBlocking, CommandInfo,
|
||||
CommitList, Component, DrawableComponent, EventState,
|
||||
InspectCommitOpen,
|
||||
},
|
||||
keys::{key_match, SharedKeyConfig},
|
||||
popups::InspectCommitOpen,
|
||||
queue::{Action, InternalEvent, Queue, StackablePopupOpen},
|
||||
strings,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue