2018-08-07 15:01:15 +03:00
|
|
|
/*
|
|
|
|
* meli - pager conf module
|
|
|
|
*
|
|
|
|
* Copyright 2018 Manos Pitsidianakis
|
|
|
|
*
|
|
|
|
* This file is part of meli.
|
|
|
|
*
|
|
|
|
* meli is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* meli is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with meli. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2020-02-04 15:52:12 +02:00
|
|
|
//! Settings for the pager function.
|
|
|
|
|
2019-04-06 00:30:06 +03:00
|
|
|
use super::default_vals::*;
|
2019-10-03 19:51:34 +03:00
|
|
|
use super::deserializers::*;
|
2020-01-02 00:07:19 +02:00
|
|
|
use melib::ToggleFlag;
|
|
|
|
|
2018-07-14 15:04:42 +03:00
|
|
|
/// Settings for the pager function.
|
2019-05-14 21:47:47 +03:00
|
|
|
#[derive(Debug, Deserialize, Clone, Default, Serialize)]
|
2018-07-13 18:38:57 +03:00
|
|
|
pub struct PagerSettings {
|
2018-07-14 15:04:42 +03:00
|
|
|
/// Number of context lines when going to next page.
|
|
|
|
/// Default: 0
|
2018-07-14 18:03:43 +03:00
|
|
|
#[serde(default = "zero_val")]
|
2018-07-14 15:04:42 +03:00
|
|
|
pub pager_context: usize,
|
|
|
|
|
|
|
|
/// Stop at the end instead of displaying next mail.
|
|
|
|
/// Default: false
|
2018-07-14 18:03:43 +03:00
|
|
|
#[serde(default = "false_val")]
|
2018-07-14 15:04:42 +03:00
|
|
|
pub pager_stop: bool,
|
2018-07-14 18:03:43 +03:00
|
|
|
|
2018-07-14 15:04:42 +03:00
|
|
|
/// Always show headers when scrolling.
|
2018-07-14 18:03:43 +03:00
|
|
|
/// Default: true
|
|
|
|
#[serde(default = "true_val")]
|
2018-07-14 15:04:42 +03:00
|
|
|
pub headers_sticky: bool,
|
2018-07-14 18:03:43 +03:00
|
|
|
|
|
|
|
/// The height of the pager in mail view, in percent.
|
|
|
|
/// Default: 80
|
|
|
|
#[serde(default = "eighty_percent")]
|
|
|
|
pub pager_ratio: usize,
|
2018-07-27 21:37:56 +03:00
|
|
|
|
2018-07-17 17:16:16 +03:00
|
|
|
/// A command to pipe mail output through for viewing in pager.
|
|
|
|
/// Default: None
|
2019-10-03 19:51:34 +03:00
|
|
|
#[serde(default = "none", deserialize_with = "non_empty_string")]
|
2018-07-17 17:16:16 +03:00
|
|
|
pub filter: Option<String>,
|
2018-07-27 21:37:56 +03:00
|
|
|
|
2019-10-03 19:51:34 +03:00
|
|
|
/// A command to pipe html output before displaying it in a pager
|
|
|
|
/// Default: None
|
|
|
|
#[serde(default = "none", deserialize_with = "non_empty_string")]
|
|
|
|
pub html_filter: Option<String>,
|
|
|
|
|
2018-07-22 14:05:12 +03:00
|
|
|
/// Respect "format=flowed"
|
|
|
|
/// Default: true
|
|
|
|
#[serde(default = "true_val")]
|
|
|
|
pub format_flowed: bool,
|
2019-11-22 13:13:27 +02:00
|
|
|
|
|
|
|
/// Split long lines that would overflow on the x axis.
|
|
|
|
/// Default: true
|
|
|
|
#[serde(default = "true_val")]
|
|
|
|
pub split_long_lines: bool,
|
|
|
|
|
|
|
|
/// Minimum text width in columns.
|
|
|
|
/// Default: 80
|
|
|
|
#[serde(default = "eighty_val")]
|
|
|
|
pub minimum_width: usize,
|
2020-01-02 00:07:19 +02:00
|
|
|
|
|
|
|
/// Choose `text/html` alternative if `text/plain` is empty in `multipart/alternative`
|
|
|
|
/// attachments.
|
|
|
|
/// Default: true
|
|
|
|
#[serde(default = "internal_value_true")]
|
|
|
|
pub auto_choose_multipart_alternative: ToggleFlag,
|
2019-11-22 13:13:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
fn eighty_val() -> usize {
|
|
|
|
80
|
2018-07-13 18:38:57 +03:00
|
|
|
}
|