From 0fca97580c6658180201bb30499c8048bdf31c98 Mon Sep 17 00:00:00 2001 From: kamillo Date: Sat, 6 May 2023 22:06:51 +0200 Subject: [PATCH] Add support for options handling in log and stashes view #1661 * Pass SharedOptions to InspectCommitComponent and CompareCommitsComponent --- src/app.rs | 2 ++ src/components/compare_commits.rs | 8 ++++++-- src/components/inspect_commit.rs | 8 ++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/app.rs b/src/app.rs index 26ce4647bd9..75d9bb97750 100644 --- a/src/app.rs +++ b/src/app.rs @@ -180,6 +180,7 @@ impl App { sender, theme.clone(), key_config.clone(), + options.clone(), ), compare_commits_popup: CompareCommitsComponent::new( &repo, @@ -187,6 +188,7 @@ impl App { sender, theme.clone(), key_config.clone(), + options.clone(), ), external_editor_popup: ExternalEditorComponent::new( theme.clone(), diff --git a/src/components/compare_commits.rs b/src/components/compare_commits.rs index 6fa1186ece2..bd92750a302 100644 --- a/src/components/compare_commits.rs +++ b/src/components/compare_commits.rs @@ -6,13 +6,14 @@ use super::{ use crate::{ accessors, keys::{key_match, SharedKeyConfig}, + options::SharedOptions, queue::{InternalEvent, Queue, StackablePopupOpen}, strings, ui::style::SharedTheme, }; use anyhow::Result; use asyncgit::{ - sync::{self, diff::DiffOptions, CommitId, RepoPathRef}, + sync::{self, CommitId, RepoPathRef}, AsyncDiff, AsyncGitNotification, CommitFilesParams, DiffParams, DiffType, }; @@ -34,6 +35,7 @@ pub struct CompareCommitsComponent { visible: bool, key_config: SharedKeyConfig, queue: Queue, + options: SharedOptions, } impl DrawableComponent for CompareCommitsComponent { @@ -172,6 +174,7 @@ impl CompareCommitsComponent { sender: &Sender, theme: SharedTheme, key_config: SharedKeyConfig, + options: SharedOptions, ) -> Self { Self { repo: repo.clone(), @@ -194,6 +197,7 @@ impl CompareCommitsComponent { visible: false, key_config, queue: queue.clone(), + options, } } @@ -256,7 +260,7 @@ impl CompareCommitsComponent { let diff_params = DiffParams { path: f.path.clone(), diff_type: DiffType::Commits(ids), - options: DiffOptions::default(), + options: self.options.borrow().diff_options(), }; if let Some((params, last)) = diff --git a/src/components/inspect_commit.rs b/src/components/inspect_commit.rs index 63cf2f82959..0ddcd30bee4 100644 --- a/src/components/inspect_commit.rs +++ b/src/components/inspect_commit.rs @@ -6,13 +6,14 @@ use super::{ use crate::{ accessors, keys::{key_match, SharedKeyConfig}, + options::SharedOptions, queue::{InternalEvent, Queue, StackablePopupOpen}, strings, ui::style::SharedTheme, }; use anyhow::Result; use asyncgit::{ - sync::{diff::DiffOptions, CommitId, CommitTags, RepoPathRef}, + sync::{CommitId, CommitTags, RepoPathRef}, AsyncDiff, AsyncGitNotification, DiffParams, DiffType, }; use crossbeam_channel::Sender; @@ -61,6 +62,7 @@ pub struct InspectCommitComponent { git_diff: AsyncDiff, visible: bool, key_config: SharedKeyConfig, + options: SharedOptions, } impl DrawableComponent for InspectCommitComponent { @@ -208,6 +210,7 @@ impl InspectCommitComponent { sender: &Sender, theme: SharedTheme, key_config: SharedKeyConfig, + options: SharedOptions, ) -> Self { Self { queue: queue.clone(), @@ -229,6 +232,7 @@ impl InspectCommitComponent { git_diff: AsyncDiff::new(repo.borrow().clone(), sender), visible: false, key_config, + options, } } @@ -272,7 +276,7 @@ impl InspectCommitComponent { diff_type: DiffType::Commit( request.commit_id, ), - options: DiffOptions::default(), + options: self.options.borrow().diff_options(), }; if let Some((params, last)) =