listing.rs: add config setting for sidebar ratio
parent
e9aaa7b067
commit
340d6451a3
|
@ -968,6 +968,11 @@ Sets the string to print in the mailbox tree for a leaf level where its root has
|
|||
.It Ic sidebar_divider Ar char
|
||||
.Pq Em optional
|
||||
Sets the character to print as the divider between the accounts list and the message list.
|
||||
.It Ic sidebar_ratio Ar Integer
|
||||
.Pq Em optional
|
||||
This is the width of the right container to the entire screen width.
|
||||
.\" default value
|
||||
.Pq Em 90
|
||||
.It Ic show_menu_scrollbar Ar boolean
|
||||
.Pq Em optional
|
||||
Show auto-hiding scrollbar in accounts sidebar menu.
|
||||
|
|
|
@ -617,6 +617,7 @@ pub struct Listing {
|
|||
cmd_buf: String,
|
||||
/// This is the width of the right container to the entire width.
|
||||
ratio: usize, // right/(container width) * 100
|
||||
prev_ratio: usize,
|
||||
menu_width: WidgetWidth,
|
||||
focus: ListingFocus,
|
||||
}
|
||||
|
@ -918,6 +919,7 @@ impl Component for Listing {
|
|||
self.menu_scrollbar_show_timer.rearm();
|
||||
self.show_menu_scrollbar = ShowMenuScrollbar::True;
|
||||
}
|
||||
self.prev_ratio = self.ratio;
|
||||
self.ratio = 50;
|
||||
self.set_dirty(true);
|
||||
}
|
||||
|
@ -1271,7 +1273,7 @@ impl Component for Listing {
|
|||
.push_back(UIEvent::StatusEvent(StatusEvent::ScrollUpdate(
|
||||
ScrollUpdate::End(self.id),
|
||||
)));
|
||||
self.ratio = 90;
|
||||
self.ratio = self.prev_ratio;
|
||||
self.set_dirty(true);
|
||||
return true;
|
||||
}
|
||||
|
@ -1283,7 +1285,7 @@ impl Component for Listing {
|
|||
self.open_status(self.menu_cursor_pos.0, context);
|
||||
self.set_dirty(true);
|
||||
self.focus = ListingFocus::Mailbox;
|
||||
self.ratio = 90;
|
||||
self.ratio = self.prev_ratio;
|
||||
context
|
||||
.replies
|
||||
.push_back(UIEvent::StatusEvent(StatusEvent::ScrollUpdate(
|
||||
|
@ -1297,7 +1299,7 @@ impl Component for Listing {
|
|||
self.cursor_pos = self.menu_cursor_pos;
|
||||
self.change_account(context);
|
||||
self.focus = ListingFocus::Mailbox;
|
||||
self.ratio = 90;
|
||||
self.ratio = self.prev_ratio;
|
||||
self.set_dirty(true);
|
||||
context
|
||||
.replies
|
||||
|
@ -1713,7 +1715,8 @@ impl Listing {
|
|||
),
|
||||
sidebar_divider_theme: conf::value(context, "mail.sidebar_divider"),
|
||||
menu_visibility: true,
|
||||
ratio: 90,
|
||||
ratio: *account_settings!(context[first_account_hash].listing.sidebar_ratio),
|
||||
prev_ratio: *account_settings!(context[first_account_hash].listing.sidebar_ratio),
|
||||
menu_width: WidgetWidth::Unset,
|
||||
focus: ListingFocus::Mailbox,
|
||||
cmd_buf: String::with_capacity(4),
|
||||
|
|
|
@ -100,6 +100,10 @@ pub struct ListingSettings {
|
|||
#[serde(default = "default_divider")]
|
||||
pub sidebar_divider: char,
|
||||
|
||||
///Default: 90
|
||||
#[serde(default = "default_ratio")]
|
||||
pub sidebar_ratio: usize,
|
||||
|
||||
/// Flag to show if thread entry contains unseen mail.
|
||||
/// Default: "●"
|
||||
#[serde(default)]
|
||||
|
@ -125,6 +129,10 @@ const fn default_divider() -> char {
|
|||
' '
|
||||
}
|
||||
|
||||
const fn default_ratio() -> usize {
|
||||
90
|
||||
}
|
||||
|
||||
impl Default for ListingSettings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
|
@ -139,6 +147,7 @@ impl Default for ListingSettings {
|
|||
sidebar_mailbox_tree_has_sibling_leaf: None,
|
||||
sidebar_mailbox_tree_no_sibling_leaf: None,
|
||||
sidebar_divider: default_divider(),
|
||||
sidebar_ratio: 90,
|
||||
unseen_flag: None,
|
||||
thread_snoozed_flag: None,
|
||||
selected_flag: None,
|
||||
|
@ -172,6 +181,7 @@ impl DotAddressable for ListingSettings {
|
|||
.sidebar_mailbox_tree_no_sibling_leaf
|
||||
.lookup(field, tail),
|
||||
"sidebar_divider" => self.sidebar_divider.lookup(field, tail),
|
||||
"sidebar_ratio" => self.sidebar_ratio.lookup(field, tail),
|
||||
"unseen_flag" => self.unseen_flag.lookup(field, tail),
|
||||
"thread_snoozed_flag" => self.thread_snoozed_flag.lookup(field, tail),
|
||||
"selected_flag" => self.selected_flag.lookup(field, tail),
|
||||
|
|
|
@ -150,6 +150,9 @@ pub struct ListingSettingsOverride {
|
|||
#[doc = "Default: ' '"]
|
||||
#[serde(default)]
|
||||
pub sidebar_divider: Option<char>,
|
||||
#[doc = "Default: 90"]
|
||||
#[serde(default)]
|
||||
pub sidebar_ratio: Option<usize>,
|
||||
#[doc = " Flag to show if thread entry contains unseen mail."]
|
||||
#[doc = " Default: \"●\""]
|
||||
#[serde(default)]
|
||||
|
@ -181,6 +184,7 @@ impl Default for ListingSettingsOverride {
|
|||
sidebar_mailbox_tree_has_sibling_leaf: None,
|
||||
sidebar_mailbox_tree_no_sibling_leaf: None,
|
||||
sidebar_divider: None,
|
||||
sidebar_ratio: None,
|
||||
unseen_flag: None,
|
||||
thread_snoozed_flag: None,
|
||||
selected_flag: None,
|
||||
|
|
Loading…
Reference in New Issue