pub enum ExpandHeight {
Half,
Full,
Fixed(u16),
}Expand description
command-line.expand-height — how tall the expanded : band grows.
Variants§
Half
Half the frame height (clamped to a sane minimum). The default, matching the MB.2b/c band.
Full
As tall as the frame allows, leaving a single pane row above.
Fixed(u16)
A fixed number of rows, clamped to what the frame can show.
Implementations§
Source§impl ExpandHeight
impl ExpandHeight
Sourcepub fn rows(&self, frame_height: u16) -> u16
pub fn rows(&self, frame_height: u16) -> u16
Resolve the policy to a concrete band height for a frame of
frame_height rows. Always leaves at least one row for the
pane area above the band (max), and never returns 0. Half
preserves the original MB.2b clamp (≥3 rows where the frame
permits). Pure + total — no panic even for tiny frames (the
lower bound is itself clamped to max).
Sourcepub fn label(&self) -> String
pub fn label(&self) -> String
The on-disk / :set spelling: half, full, or the row count
as a bare integer. The inverse of Self::parse_label. Owned
(unlike the other value types’ label) because Fixed(n) is
formatted.
Sourcepub fn doc(&self) -> &'static str
pub fn doc(&self) -> &'static str
One-line description of this value for the :set value
completion marginalia. Fixed shares one description whatever
its row count.
Sourcepub fn parse_label(s: &str) -> Result<Self, String>
pub fn parse_label(s: &str) -> Result<Self, String>
Parse half, full, or a u16 row count (surrounding
whitespace ignored). 0 parses as Fixed(0); Self::rows
clamps it up to one row.
§Examples
use lattice_config::ExpandHeight;
assert_eq!(ExpandHeight::parse_label(" 12 "), Ok(ExpandHeight::Fixed(12)));
// A 40-row frame: `half` is 20 rows, `full` keeps two rows back.
assert_eq!(ExpandHeight::Half.rows(40), 20);
assert_eq!(ExpandHeight::Full.rows(40), 38);
// Fixed heights clamp to what the frame can show.
assert_eq!(ExpandHeight::Fixed(100).rows(40), 38);
assert!(ExpandHeight::parse_label("tall").is_err());Trait Implementations§
Source§impl Clone for ExpandHeight
impl Clone for ExpandHeight
Source§fn clone(&self) -> ExpandHeight
fn clone(&self) -> ExpandHeight
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ExpandHeight
Source§impl Debug for ExpandHeight
impl Debug for ExpandHeight
Source§impl Default for ExpandHeight
impl Default for ExpandHeight
Source§fn default() -> ExpandHeight
fn default() -> ExpandHeight
impl Eq for ExpandHeight
Source§impl OptionType for ExpandHeight
impl OptionType for ExpandHeight
Source§fn parse(s: &str) -> Result<Self, String>
fn parse(s: &str) -> Result<Self, String>
:set name=value. Errors are
surfaced verbatim through the cmdline echo, so the message
should read well to the user (mention valid forms when the
space is finite). The parser MUST round-trip with format:
T::parse(&v.format()) == Ok(v) for every v.Source§fn format(&self) -> String
fn format(&self) -> String
:set foo? echo,
the customize buffer view, value comparison). Round-trips
with Self::parse.Source§fn type_label() -> &'static str
fn type_label() -> &'static str
:describe-option ("boolean",
"foldmethod", etc.). Used in help bodies and the customize
buffer view.Source§fn enumerate() -> Option<Vec<&'static str>>
fn enumerate() -> Option<Vec<&'static str>>
:set foo=<Tab>
completion. None means “free-form” (no enumerable space –
integers, file paths, free strings). The values are
&'static str to keep the completion source allocation-free
in the common case.Source§fn enumerate_with_docs() -> Option<Vec<EnumeratedValue>>
fn enumerate_with_docs() -> Option<Vec<EnumeratedValue>>
Self::enumerate with empty docs;
types with rich help override. Read moreSource§fn name_forms(_canonical: &str) -> Vec<String>
fn name_forms(_canonical: &str) -> Vec<String>
:set nu / :set nonu). Default:
no extra forms. Booleans return [format!("no{canonical}")].Source§fn is_bool() -> bool
fn is_bool() -> bool
:set noFOO. bool
returns true; everything else false. Drives the negate
path in the cmdline parser.Source§fn accepts_list() -> bool
fn accepts_list() -> bool
Self::parse accepts, rather than rejected
as “not applicable to a scalar option”. false for every
scalar type (the default); true for list types like
crate::ModelineZone. Drives loader::apply_array (ML.5).
The :set cmdline path is unaffected — it always passes a
string and never sees a TOML array.Source§fn try_negation_value() -> Result<Self, String>
fn try_negation_value() -> Result<Self, String>
Self::is_bool true).
Default: returns Err – the registry guards by checking
is_bool() first, so callers that respect the contract
won’t observe this. The bool impl returns Ok(false).Source§fn enumerate_is_exhaustive() -> bool
fn enumerate_is_exhaustive() -> bool
Self::enumerate is the COMPLETE set of valid values
(a closed enum) or a completion hint over an open space. Read moreSource§fn schema() -> ConfigSchema
fn schema() -> ConfigSchema
Source§fn to_value(&self) -> ConfigValue
fn to_value(&self) -> ConfigValue
Source§fn from_value(value: &ConfigValue) -> Result<Self, String>
fn from_value(value: &ConfigValue) -> Result<Self, String>
Self::to_value,
deferring to parse so a type’s validation rules apply on this
path exactly as they do on :set.Source§impl PartialEq for ExpandHeight
impl PartialEq for ExpandHeight
impl StructuralPartialEq for ExpandHeight
Auto Trait Implementations§
impl Freeze for ExpandHeight
impl RefUnwindSafe for ExpandHeight
impl Send for ExpandHeight
impl Sync for ExpandHeight
impl Unpin for ExpandHeight
impl UnsafeUnpin for ExpandHeight
impl UnwindSafe for ExpandHeight
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.