From 5f8c333a247d3277dffbba66331f46052ae5d34b Mon Sep 17 00:00:00 2001 From: Stephan Dilly Date: Tue, 19 May 2020 20:38:56 +0200 Subject: [PATCH] pass theme as ref where possible --- CHANGELOG.md | 2 +- src/app.rs | 10 +++++----- src/components/changes.rs | 4 ++-- src/components/commit.rs | 4 ++-- src/components/diff.rs | 4 ++-- src/components/help.rs | 4 ++-- src/components/reset.rs | 4 ++-- src/tabs/revlog/mod.rs | 8 ++++---- src/tabs/status.rs | 2 +- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ae49493..6e76e63d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added -- support for color themes and light mode([#28](https://github.com/extrawurst/gitui/issues/28)) +- support color themes and light mode [[@MCord](https://github.com/MCord)] ([#28](https://github.com/extrawurst/gitui/issues/28)) ## [0.2.6] - 2020-05-18 ### Fixed diff --git a/src/app.rs b/src/app.rs index e1ce02c5..62faff6e 100644 --- a/src/app.rs +++ b/src/app.rs @@ -51,15 +51,15 @@ impl App { let theme = Theme::init(); Self { - reset: ResetComponent::new(queue.clone(), theme), - commit: CommitComponent::new(queue.clone(), theme), + reset: ResetComponent::new(queue.clone(), &theme), + commit: CommitComponent::new(queue.clone(), &theme), do_quit: false, current_commands: Vec::new(), - help: HelpComponent::new(theme), + help: HelpComponent::new(&theme), msg: MsgComponent::default(), tab: 0, - revlog: Revlog::new(&sender, theme), - status_tab: Status::new(&sender, &queue, theme), + revlog: Revlog::new(&sender, &theme), + status_tab: Status::new(&sender, &queue, &theme), queue, theme, } diff --git a/src/components/changes.rs b/src/components/changes.rs index 6ea16519..8c1c4f87 100644 --- a/src/components/changes.rs +++ b/src/components/changes.rs @@ -35,7 +35,7 @@ impl ChangesComponent { focus: bool, is_working_dir: bool, queue: Queue, - theme: Theme, + theme: &Theme, ) -> Self { Self { title: title.to_string(), @@ -45,7 +45,7 @@ impl ChangesComponent { show_selection: focus, is_working_dir, queue, - theme, + theme: *theme, } } diff --git a/src/components/commit.rs b/src/components/commit.rs index 2cdd042e..6292bc90 100644 --- a/src/components/commit.rs +++ b/src/components/commit.rs @@ -112,12 +112,12 @@ impl Component for CommitComponent { impl CommitComponent { /// - pub fn new(queue: Queue, theme: Theme) -> Self { + pub fn new(queue: Queue, theme: &Theme) -> Self { Self { queue, msg: String::default(), visible: false, - theme, + theme: *theme, } } diff --git a/src/components/diff.rs b/src/components/diff.rs index 5aa99857..a9273eb9 100644 --- a/src/components/diff.rs +++ b/src/components/diff.rs @@ -41,7 +41,7 @@ pub struct DiffComponent { impl DiffComponent { /// - pub fn new(queue: Queue, theme: Theme) -> Self { + pub fn new(queue: Queue, theme: &Theme) -> Self { Self { focused: false, queue, @@ -50,7 +50,7 @@ impl DiffComponent { diff: FileDiff::default(), scroll: 0, current_height: 0, - theme, + theme: *theme, } } /// diff --git a/src/components/help.rs b/src/components/help.rs index b9787338..bde7d77d 100644 --- a/src/components/help.rs +++ b/src/components/help.rs @@ -154,12 +154,12 @@ impl Component for HelpComponent { } impl HelpComponent { - pub fn new(theme: Theme) -> Self { + pub fn new(theme: &Theme) -> Self { Self { cmds: vec![], visible: false, selection: 0, - theme, + theme: *theme, } } /// diff --git a/src/components/reset.rs b/src/components/reset.rs index e755e5bd..c91dcc01 100644 --- a/src/components/reset.rs +++ b/src/components/reset.rs @@ -102,12 +102,12 @@ impl Component for ResetComponent { impl ResetComponent { /// - pub fn new(queue: Queue, theme: Theme) -> Self { + pub fn new(queue: Queue, theme: &Theme) -> Self { Self { target: None, visible: false, queue, - theme, + theme: *theme, } } /// diff --git a/src/tabs/revlog/mod.rs b/src/tabs/revlog/mod.rs index 982f25f9..8fcad493 100644 --- a/src/tabs/revlog/mod.rs +++ b/src/tabs/revlog/mod.rs @@ -44,7 +44,7 @@ impl Revlog { /// pub fn new( sender: &Sender, - theme: Theme, + theme: &Theme, ) -> Self { Self { items: ItemBatch::default(), @@ -57,7 +57,7 @@ impl Revlog { tags: Tags::new(), current_size: (0, 0), scroll_top: 0, - theme, + theme: *theme, } } @@ -156,7 +156,7 @@ impl Revlog { selected: bool, txt: &mut Vec>, tags: Option, - theme: Theme, + theme: &Theme, ) { let count_before = txt.len(); @@ -213,7 +213,7 @@ impl Revlog { idx == selection, &mut txt, tag, - self.theme, + &self.theme, ); } diff --git a/src/tabs/status.rs b/src/tabs/status.rs index c3384932..4b371480 100644 --- a/src/tabs/status.rs +++ b/src/tabs/status.rs @@ -100,7 +100,7 @@ impl Status { pub fn new( sender: &Sender, queue: &Queue, - theme: Theme, + theme: &Theme, ) -> Self { Self { visible: true,