diff options
author | Denys Séguret <cano.petrole@gmail.com> | 2022-11-04 21:14:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-04 21:14:17 +0100 |
commit | f3bc7d56cf6b3be4b09c0acc0f68541de679b5da (patch) | |
tree | d353806a343b37b91f7ae948be29c67afbf6af37 /src/app | |
parent | 6549df4bc93aef3961cd8350fe8b7d775d6506b5 (diff) |
make content search max file size configurable (#628)
Fix #626
Diffstat (limited to 'src/app')
-rw-r--r-- | src/app/app_context.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/app/app_context.rs b/src/app/app_context.rs index 7bf0445..7cbd874 100644 --- a/src/app/app_context.rs +++ b/src/app/app_context.rs @@ -3,6 +3,7 @@ use { crate::{ cli::{Args, TriBool}, conf::Conf, + content_search, errors::*, file_sum, icon::*, @@ -86,6 +87,9 @@ pub struct AppContext { /// number of files which may be staged in one staging operation pub max_staged_count: usize, + + /// max file size when searching file content + pub content_search_max_file_size: usize, } impl AppContext { @@ -143,6 +147,10 @@ impl AppContext { initial_tree_options.show_selection_mark = true; } + let content_search_max_file_size = config.content_search_max_file_size + .map(|u64value| usize::try_from(u64value).unwrap_or(usize::MAX)) + .unwrap_or(content_search::DEFAULT_MAX_FILE_SIZE); + Ok(Self { initial_root, initial_tree_options, @@ -163,6 +171,7 @@ impl AppContext { quit_on_last_cancel: config.quit_on_last_cancel.unwrap_or(false), file_sum_threads_count, max_staged_count, + content_search_max_file_size, }) } } |