From 5a7c85daeeba6256f39891daf431be5f5a0e9f66 Mon Sep 17 00:00:00 2001 From: Stephan Dilly Date: Wed, 1 Dec 2021 09:12:39 +0100 Subject: [PATCH] rename --- src/components/changes.rs | 6 +++--- src/components/commit_details/mod.rs | 8 ++++---- src/components/filetree.rs | 13 ++++++------- src/components/mod.rs | 2 +- src/tabs/stashing.rs | 6 +++--- 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/components/changes.rs b/src/components/changes.rs index 6d78bbf6..c10975bf 100644 --- a/src/components/changes.rs +++ b/src/components/changes.rs @@ -1,5 +1,5 @@ use super::{ - filetree::FileTreeComponent, + filetree::StatusTreeComponent, utils::filetree::{FileTreeItem, FileTreeItemKind}, CommandBlocking, DrawableComponent, SharedOptions, }; @@ -18,7 +18,7 @@ use tui::{backend::Backend, layout::Rect, Frame}; /// pub struct ChangesComponent { - files: FileTreeComponent, + files: StatusTreeComponent, is_working_dir: bool, queue: Queue, key_config: SharedKeyConfig, @@ -37,7 +37,7 @@ impl ChangesComponent { options: SharedOptions, ) -> Self { Self { - files: FileTreeComponent::new( + files: StatusTreeComponent::new( title, focus, Some(queue.clone()), diff --git a/src/components/commit_details/mod.rs b/src/components/commit_details/mod.rs index 93ef362c..9f8f2d3b 100644 --- a/src/components/commit_details/mod.rs +++ b/src/components/commit_details/mod.rs @@ -4,7 +4,7 @@ mod style; use super::{ command_pump, event_pump, CommandBlocking, CommandInfo, - Component, DrawableComponent, EventState, FileTreeComponent, + Component, DrawableComponent, EventState, StatusTreeComponent, }; use crate::{ accessors, keys::SharedKeyConfig, queue::Queue, strings, @@ -29,7 +29,7 @@ pub struct CommitDetailsComponent { commit: Option, single_details: DetailsComponent, compare_details: CompareDetailsComponent, - file_tree: FileTreeComponent, + file_tree: StatusTreeComponent, git_commit_files: AsyncCommitFiles, visible: bool, key_config: SharedKeyConfig, @@ -56,7 +56,7 @@ impl CommitDetailsComponent { false, ), git_commit_files: AsyncCommitFiles::new(sender), - file_tree: FileTreeComponent::new( + file_tree: StatusTreeComponent::new( "", false, Some(queue.clone()), @@ -126,7 +126,7 @@ impl CommitDetailsComponent { } /// - pub const fn files(&self) -> &FileTreeComponent { + pub const fn files(&self) -> &StatusTreeComponent { &self.file_tree } diff --git a/src/components/filetree.rs b/src/components/filetree.rs index f1e266bd..275e9042 100644 --- a/src/components/filetree.rs +++ b/src/components/filetree.rs @@ -19,11 +19,10 @@ use crossterm::event::Event; use std::{borrow::Cow, cell::Cell, convert::From, path::Path}; use tui::{backend::Backend, layout::Rect, text::Span, Frame}; -//TODO: rename so that its clear this only works for Statuses //TODO: use new `filetreelist` crate /// -pub struct FileTreeComponent { +pub struct StatusTreeComponent { title: String, tree: StatusTree, pending: bool, @@ -36,7 +35,7 @@ pub struct FileTreeComponent { scroll_top: Cell, } -impl FileTreeComponent { +impl StatusTreeComponent { /// pub fn new( title: &str, @@ -308,7 +307,7 @@ struct TextDrawInfo<'a> { item_kind: &'a FileTreeItemKind, } -impl DrawableComponent for FileTreeComponent { +impl DrawableComponent for StatusTreeComponent { fn draw( &self, f: &mut Frame, @@ -377,7 +376,7 @@ impl DrawableComponent for FileTreeComponent { } } -impl Component for FileTreeComponent { +impl Component for StatusTreeComponent { fn commands( &self, out: &mut Vec, @@ -496,7 +495,7 @@ mod tests { let mut frame = terminal.get_frame(); // set up file tree - let mut ftc = FileTreeComponent::new( + let mut ftc = StatusTreeComponent::new( "title", true, None, @@ -537,7 +536,7 @@ mod tests { let mut frame = terminal.get_frame(); // set up file tree - let mut ftc = FileTreeComponent::new( + let mut ftc = StatusTreeComponent::new( "title", true, None, diff --git a/src/components/mod.rs b/src/components/mod.rs index 6e040276..8d1df695 100644 --- a/src/components/mod.rs +++ b/src/components/mod.rs @@ -31,7 +31,7 @@ mod taglist; mod textinput; mod utils; -pub use self::filetree::FileTreeComponent; +pub use self::filetree::StatusTreeComponent; pub use blame_file::BlameFileComponent; pub use branchlist::BranchListComponent; pub use changes::ChangesComponent; diff --git a/src/tabs/stashing.rs b/src/tabs/stashing.rs index f2b65124..13d10a4a 100644 --- a/src/tabs/stashing.rs +++ b/src/tabs/stashing.rs @@ -3,7 +3,7 @@ use crate::{ components::{ command_pump, event_pump, visibility_blocking, CommandBlocking, CommandInfo, Component, DrawableComponent, - EventState, FileTreeComponent, + EventState, StatusTreeComponent, }, keys::SharedKeyConfig, queue::{InternalEvent, Queue}, @@ -31,7 +31,7 @@ pub struct StashingOptions { } pub struct Stashing { - index: FileTreeComponent, + index: StatusTreeComponent, visible: bool, options: StashingOptions, theme: SharedTheme, @@ -51,7 +51,7 @@ impl Stashing { key_config: SharedKeyConfig, ) -> Self { Self { - index: FileTreeComponent::new( + index: StatusTreeComponent::new( &strings::stashing_files_title(&key_config), true, Some(queue.clone()),