Add support for options handling in log and stashes views #1661 (#1675)

This commit is contained in:
kamillo 2023-06-19 15:40:26 +02:00 committed by GitHub
parent 4f3be697d5
commit 58e72cd22b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 4 deletions

View file

@ -54,6 +54,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* crashes on entering submodules ([#1510](https://github.com/extrawurst/gitui/issues/1510)) * crashes on entering submodules ([#1510](https://github.com/extrawurst/gitui/issues/1510))
* fix race issue: revlog messages sometimes appear empty ([#1473](https://github.com/extrawurst/gitui/issues/1473)) * fix race issue: revlog messages sometimes appear empty ([#1473](https://github.com/extrawurst/gitui/issues/1473))
* default to tick-based updates [[@cruessler](https://github.com/cruessler)] ([#1444](https://github.com/extrawurst/gitui/issues/1444)) * default to tick-based updates [[@cruessler](https://github.com/cruessler)] ([#1444](https://github.com/extrawurst/gitui/issues/1444))
* add support for options handling in log and stashes views [[@kamillo](https://github.com/kamillo)] ([#1661](https://github.com/extrawurst/gitui/issues/1661))
### Changed ### Changed
* minimum supported rust version bumped to 1.64 (thank you `clap`) * minimum supported rust version bumped to 1.64 (thank you `clap`)

View file

@ -180,6 +180,7 @@ impl App {
sender, sender,
theme.clone(), theme.clone(),
key_config.clone(), key_config.clone(),
options.clone(),
), ),
compare_commits_popup: CompareCommitsComponent::new( compare_commits_popup: CompareCommitsComponent::new(
&repo, &repo,
@ -187,6 +188,7 @@ impl App {
sender, sender,
theme.clone(), theme.clone(),
key_config.clone(), key_config.clone(),
options.clone(),
), ),
external_editor_popup: ExternalEditorComponent::new( external_editor_popup: ExternalEditorComponent::new(
theme.clone(), theme.clone(),

View file

@ -6,13 +6,14 @@ use super::{
use crate::{ use crate::{
accessors, accessors,
keys::{key_match, SharedKeyConfig}, keys::{key_match, SharedKeyConfig},
options::SharedOptions,
queue::{InternalEvent, Queue, StackablePopupOpen}, queue::{InternalEvent, Queue, StackablePopupOpen},
strings, strings,
ui::style::SharedTheme, ui::style::SharedTheme,
}; };
use anyhow::Result; use anyhow::Result;
use asyncgit::{ use asyncgit::{
sync::{self, diff::DiffOptions, CommitId, RepoPathRef}, sync::{self, CommitId, RepoPathRef},
AsyncDiff, AsyncGitNotification, CommitFilesParams, DiffParams, AsyncDiff, AsyncGitNotification, CommitFilesParams, DiffParams,
DiffType, DiffType,
}; };
@ -34,6 +35,7 @@ pub struct CompareCommitsComponent {
visible: bool, visible: bool,
key_config: SharedKeyConfig, key_config: SharedKeyConfig,
queue: Queue, queue: Queue,
options: SharedOptions,
} }
impl DrawableComponent for CompareCommitsComponent { impl DrawableComponent for CompareCommitsComponent {
@ -172,6 +174,7 @@ impl CompareCommitsComponent {
sender: &Sender<AsyncGitNotification>, sender: &Sender<AsyncGitNotification>,
theme: SharedTheme, theme: SharedTheme,
key_config: SharedKeyConfig, key_config: SharedKeyConfig,
options: SharedOptions,
) -> Self { ) -> Self {
Self { Self {
repo: repo.clone(), repo: repo.clone(),
@ -194,6 +197,7 @@ impl CompareCommitsComponent {
visible: false, visible: false,
key_config, key_config,
queue: queue.clone(), queue: queue.clone(),
options,
} }
} }
@ -256,7 +260,7 @@ impl CompareCommitsComponent {
let diff_params = DiffParams { let diff_params = DiffParams {
path: f.path.clone(), path: f.path.clone(),
diff_type: DiffType::Commits(ids), diff_type: DiffType::Commits(ids),
options: DiffOptions::default(), options: self.options.borrow().diff_options(),
}; };
if let Some((params, last)) = if let Some((params, last)) =

View file

@ -6,13 +6,14 @@ use super::{
use crate::{ use crate::{
accessors, accessors,
keys::{key_match, SharedKeyConfig}, keys::{key_match, SharedKeyConfig},
options::SharedOptions,
queue::{InternalEvent, Queue, StackablePopupOpen}, queue::{InternalEvent, Queue, StackablePopupOpen},
strings, strings,
ui::style::SharedTheme, ui::style::SharedTheme,
}; };
use anyhow::Result; use anyhow::Result;
use asyncgit::{ use asyncgit::{
sync::{diff::DiffOptions, CommitId, CommitTags, RepoPathRef}, sync::{CommitId, CommitTags, RepoPathRef},
AsyncDiff, AsyncGitNotification, DiffParams, DiffType, AsyncDiff, AsyncGitNotification, DiffParams, DiffType,
}; };
use crossbeam_channel::Sender; use crossbeam_channel::Sender;
@ -61,6 +62,7 @@ pub struct InspectCommitComponent {
git_diff: AsyncDiff, git_diff: AsyncDiff,
visible: bool, visible: bool,
key_config: SharedKeyConfig, key_config: SharedKeyConfig,
options: SharedOptions,
} }
impl DrawableComponent for InspectCommitComponent { impl DrawableComponent for InspectCommitComponent {
@ -208,6 +210,7 @@ impl InspectCommitComponent {
sender: &Sender<AsyncGitNotification>, sender: &Sender<AsyncGitNotification>,
theme: SharedTheme, theme: SharedTheme,
key_config: SharedKeyConfig, key_config: SharedKeyConfig,
options: SharedOptions,
) -> Self { ) -> Self {
Self { Self {
queue: queue.clone(), queue: queue.clone(),
@ -229,6 +232,7 @@ impl InspectCommitComponent {
git_diff: AsyncDiff::new(repo.borrow().clone(), sender), git_diff: AsyncDiff::new(repo.borrow().clone(), sender),
visible: false, visible: false,
key_config, key_config,
options,
} }
} }
@ -272,7 +276,7 @@ impl InspectCommitComponent {
diff_type: DiffType::Commit( diff_type: DiffType::Commit(
request.commit_id, request.commit_id,
), ),
options: DiffOptions::default(), options: self.options.borrow().diff_options(),
}; };
if let Some((params, last)) = if let Some((params, last)) =