pub struct StatusLine<U: Ui> { /* private fields */ }Expand description
A widget to show information, usually about a File
This widget is updated whenever any of its parts needs to be
updated, and it also automatically adjusts to where it was pushed.
For example, if you push it with OnFileOpen, it’s information
will point to the File to which it was pushed. However, if you
push it with OnWindowOpen, it will always point to the
currently active File:
hooks::remove("FileWidgets");
hooks::add::<OnFileOpen<U>>(|builder| {
builder.push(LineNumbers::cfg());
builder.push(status!([File] { File::name }));
});
hooks::remove("WindowWidgets");
hooks::add::<OnWindowOpen<U>>(|builder| {
let (status_area, _) = builder.push(status!(
[File] { File::name } " " selections_fmt " " main_fmt
));
builder.push_to(CmdLine::cfg().left_ratioed(2, 3), status_area);
});In the above example, each file would have a status line with the name of the file, and there would be a global status line, showing more information about the currently active file.
You will usually want to create StatusLines via the
status! macro, since that is how you can customize it.
Although, if you want the regular status line, you can just:
hooks::remove("FileWidgets");
hooks::add::<OnFileOpen<U>>(|builder| {
builder.push(LineNumbers::cfg());
builder.push(StatusLine::cfg());
});Trait Implementations§
Source§impl<U: Ui> Widget<U> for StatusLine<U>
impl<U: Ui> Widget<U> for StatusLine<U>
Source§type Cfg = StatusLineCfg<U>
type Cfg = StatusLineCfg<U>
The configuration type
Source§fn cursors_mut(&mut self) -> Option<&mut Cursors>
fn cursors_mut(&mut self) -> Option<&mut Cursors>
A mutable reference to the
Cursors, if they existSource§fn on_unfocus(&mut self, area: &U::Area)
fn on_unfocus(&mut self, area: &U::Area)
Actions to do whenever this
Widget is unfocused.Auto Trait Implementations§
impl<U> !Freeze for StatusLine<U>
impl<U> !RefUnwindSafe for StatusLine<U>
impl<U> Send for StatusLine<U>
impl<U> Sync for StatusLine<U>
impl<U> Unpin for StatusLine<U>
impl<U> !UnwindSafe for StatusLine<U>
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
Mutably borrows from an owned value. Read more