diff options
author | Clement Tsang <34804052+ClementTsang@users.noreply.github.com> | 2020-11-28 15:37:06 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-28 15:37:06 -0500 |
commit | 3260ff4663baed9b2186ee130306dc71e5d521fd (patch) | |
tree | dd0ce4b737bede4b643fa0d1680e0b9ff9852747 /src/options.rs | |
parent | a9c1197075d7897cc3066657820eb321434eb0c0 (diff) |
feature: Add scroll indicator to keep track of table position in widgets. (#333)
Adds the option to enable an "out of" indicator for scrollable table widgets (using --show_table_scroll_position).
Diffstat (limited to 'src/options.rs')
-rw-r--r-- | src/options.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/options.rs b/src/options.rs index 53ccd223..cfdeca88 100644 --- a/src/options.rs +++ b/src/options.rs @@ -147,6 +147,9 @@ pub struct ConfigFlags { #[builder(default, setter(strip_option))] pub tree: Option<bool>, + + #[builder(default, setter(strip_option))] + show_table_scroll_position: Option<bool>, } #[derive(Clone, Default, Debug, Deserialize, Serialize)] @@ -388,6 +391,7 @@ pub fn build_app( disable_click: get_disable_click(matches, config), // no_write: get_no_write(matches, config), no_write: false, + show_table_scroll_position: get_show_table_scroll_position(matches, config), }; let used_widgets = UsedWidgets { @@ -972,3 +976,14 @@ fn get_is_default_tree(matches: &clap::ArgMatches<'static>, config: &Config) -> } false } + +fn get_show_table_scroll_position(matches: &clap::ArgMatches<'static>, config: &Config) -> bool { + if matches.is_present("show_table_scroll_position") { + return true; + } else if let Some(flags) = &config.flags { + if let Some(show_table_scroll_position) = flags.show_table_scroll_position { + return show_table_scroll_position; + } + } + false +} |