Skip to content

Commit 5f8c333

Browse files
author
Stephan Dilly
committed
pass theme as ref where possible
1 parent 4ec1a4e commit 5f8c333

File tree

9 files changed

+21
-21
lines changed

9 files changed

+21
-21
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88
### Added
9-
- support for color themes and light mode([#28](https://github.com/extrawurst/gitui/issues/28))
9+
- support color themes and light mode [[@MCord](https://github.com/MCord)] ([#28](https://github.com/extrawurst/gitui/issues/28))
1010

1111
## [0.2.6] - 2020-05-18
1212
### Fixed

src/app.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ impl App {
5151
let theme = Theme::init();
5252

5353
Self {
54-
reset: ResetComponent::new(queue.clone(), theme),
55-
commit: CommitComponent::new(queue.clone(), theme),
54+
reset: ResetComponent::new(queue.clone(), &theme),
55+
commit: CommitComponent::new(queue.clone(), &theme),
5656
do_quit: false,
5757
current_commands: Vec::new(),
58-
help: HelpComponent::new(theme),
58+
help: HelpComponent::new(&theme),
5959
msg: MsgComponent::default(),
6060
tab: 0,
61-
revlog: Revlog::new(&sender, theme),
62-
status_tab: Status::new(&sender, &queue, theme),
61+
revlog: Revlog::new(&sender, &theme),
62+
status_tab: Status::new(&sender, &queue, &theme),
6363
queue,
6464
theme,
6565
}

src/components/changes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl ChangesComponent {
3535
focus: bool,
3636
is_working_dir: bool,
3737
queue: Queue,
38-
theme: Theme,
38+
theme: &Theme,
3939
) -> Self {
4040
Self {
4141
title: title.to_string(),
@@ -45,7 +45,7 @@ impl ChangesComponent {
4545
show_selection: focus,
4646
is_working_dir,
4747
queue,
48-
theme,
48+
theme: *theme,
4949
}
5050
}
5151

src/components/commit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ impl Component for CommitComponent {
112112

113113
impl CommitComponent {
114114
///
115-
pub fn new(queue: Queue, theme: Theme) -> Self {
115+
pub fn new(queue: Queue, theme: &Theme) -> Self {
116116
Self {
117117
queue,
118118
msg: String::default(),
119119
visible: false,
120-
theme,
120+
theme: *theme,
121121
}
122122
}
123123

src/components/diff.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub struct DiffComponent {
4141

4242
impl DiffComponent {
4343
///
44-
pub fn new(queue: Queue, theme: Theme) -> Self {
44+
pub fn new(queue: Queue, theme: &Theme) -> Self {
4545
Self {
4646
focused: false,
4747
queue,
@@ -50,7 +50,7 @@ impl DiffComponent {
5050
diff: FileDiff::default(),
5151
scroll: 0,
5252
current_height: 0,
53-
theme,
53+
theme: *theme,
5454
}
5555
}
5656
///

src/components/help.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,12 @@ impl Component for HelpComponent {
154154
}
155155

156156
impl HelpComponent {
157-
pub fn new(theme: Theme) -> Self {
157+
pub fn new(theme: &Theme) -> Self {
158158
Self {
159159
cmds: vec![],
160160
visible: false,
161161
selection: 0,
162-
theme,
162+
theme: *theme,
163163
}
164164
}
165165
///

src/components/reset.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ impl Component for ResetComponent {
102102

103103
impl ResetComponent {
104104
///
105-
pub fn new(queue: Queue, theme: Theme) -> Self {
105+
pub fn new(queue: Queue, theme: &Theme) -> Self {
106106
Self {
107107
target: None,
108108
visible: false,
109109
queue,
110-
theme,
110+
theme: *theme,
111111
}
112112
}
113113
///

src/tabs/revlog/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl Revlog {
4444
///
4545
pub fn new(
4646
sender: &Sender<AsyncNotification>,
47-
theme: Theme,
47+
theme: &Theme,
4848
) -> Self {
4949
Self {
5050
items: ItemBatch::default(),
@@ -57,7 +57,7 @@ impl Revlog {
5757
tags: Tags::new(),
5858
current_size: (0, 0),
5959
scroll_top: 0,
60-
theme,
60+
theme: *theme,
6161
}
6262
}
6363

@@ -156,7 +156,7 @@ impl Revlog {
156156
selected: bool,
157157
txt: &mut Vec<Text<'a>>,
158158
tags: Option<String>,
159-
theme: Theme,
159+
theme: &Theme,
160160
) {
161161
let count_before = txt.len();
162162

@@ -213,7 +213,7 @@ impl Revlog {
213213
idx == selection,
214214
&mut txt,
215215
tag,
216-
self.theme,
216+
&self.theme,
217217
);
218218
}
219219

src/tabs/status.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl Status {
100100
pub fn new(
101101
sender: &Sender<AsyncNotification>,
102102
queue: &Queue,
103-
theme: Theme,
103+
theme: &Theme,
104104
) -> Self {
105105
Self {
106106
visible: true,

0 commit comments

Comments
 (0)