pub struct StatusModel<'a> {
pub mode: Mode,
pub line: usize,
pub column: usize,
pub prompt: PromptKind,
pub prompt_text: &'a str,
pub prompt_caret: usize,
pub count: MatchCount,
pub message: Option<&'a str>,
}Expand description
Everything a status line needs, borrowed from the editor state.
Borrowed rather than owned so building it costs nothing per frame — a face may call this every redraw.
Fields§
§mode: Mode§line: usize1-based, display-ready.
column: usize1-based, display-ready.
prompt: PromptKind§prompt_text: &'a strWhat has been typed into the prompt, without the sigil.
prompt_caret: usizeWhere the caret sits inside prompt_text, in CHARS.
Chars, not bytes, because a face positions a cursor by column and a
byte index is the wrong number the moment the pattern contains é.
A face draws its cursor at sigil_width + prompt_caret.
count: MatchCount[3/17]. MatchCount::Idle when there is nothing to say.
message: Option<&'a str>The newest message — vim’s E486 and friends. These were written to
EditorState::messages from the start and had no reader outside the
eval CLI’s println!, so a failed search was indistinguishable from
a dropped keystroke on both interactive faces.
Implementations§
Source§impl StatusModel<'_>
impl StatusModel<'_>
Sourcepub fn mode_label(self) -> &'static str
pub fn mode_label(self) -> &'static str
What the mode indicator should SAY — which is not always the mode.
vim’s / reuses the command line, so escriba’s search runs in
Mode::Command. Reporting the raw mode therefore labelled a search
COMMAND and drew it with the : glyph: pressing / produced a
status line indistinguishable from having pressed :. The mode was
right and the report was wrong — an implementation detail (which
mode hosts the prompt) leaking into what the operator is told.
Derived from the same typed PromptKind the sigil comes from, so the
label and the sigil cannot disagree.
Sourcepub const fn pill_sigil(self) -> Option<char>
pub const fn pill_sigil(self) -> Option<char>
The character the mode indicator leads with, when a prompt is open.
None means “no prompt — use your own mode glyph”. A face that draws
a pill takes this over its mode glyph so / and ? read as
themselves instead of as the : of an ex-command.
Sourcepub fn render_prompt_into(self, out: &mut String)
pub fn render_prompt_into(self, out: &mut String)
Render the prompt segment (/foo) into out. Empty when no prompt is
open.
Trait Implementations§
Source§impl<'a> Clone for StatusModel<'a>
impl<'a> Clone for StatusModel<'a>
Source§fn clone(&self) -> StatusModel<'a>
fn clone(&self) -> StatusModel<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<'a> Copy for StatusModel<'a>
Auto Trait Implementations§
impl<'a> Freeze for StatusModel<'a>
impl<'a> RefUnwindSafe for StatusModel<'a>
impl<'a> Send for StatusModel<'a>
impl<'a> Sync for StatusModel<'a>
impl<'a> Unpin for StatusModel<'a>
impl<'a> UnsafeUnpin for StatusModel<'a>
impl<'a> UnwindSafe for StatusModel<'a>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.