pass theme as ref where possible

This commit is contained in:
Stephan Dilly 2020-05-19 20:38:56 +02:00
parent 4ec1a4e94b
commit 5f8c333a24
9 changed files with 21 additions and 21 deletions

View file

@ -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

View file

@ -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,
}

View file

@ -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,
}
}

View file

@ -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,
}
}

View file

@ -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,
}
}
///

View file

@ -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,
}
}
///

View file

@ -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,
}
}
///

View file

@ -44,7 +44,7 @@ impl Revlog {
///
pub fn new(
sender: &Sender<AsyncNotification>,
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<Text<'a>>,
tags: Option<String>,
theme: Theme,
theme: &Theme,
) {
let count_before = txt.len();
@ -213,7 +213,7 @@ impl Revlog {
idx == selection,
&mut txt,
tag,
self.theme,
&self.theme,
);
}

View file

@ -100,7 +100,7 @@ impl Status {
pub fn new(
sender: &Sender<AsyncNotification>,
queue: &Queue,
theme: Theme,
theme: &Theme,
) -> Self {
Self {
visible: true,