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 to a file (via hook::add::<File>,
for example), it’s information will point to the File to which
it was pushed. However, if you push it with WindowCreated, it
will always point to the currently active File:
setup_duat!(setup);
use duat::prelude::*;
fn setup() {
hook::add::<File>(|_, (cfg, builder)| {
builder.push(status!("{name_txt}").above());
cfg
});
hook::remove("WindowWidgets");
hook::add::<WindowCreated>(|pa, builder| {
builder.push(FooterWidgets::new(status!(
"{} {sels_txt} {main_txt}",
mode_txt(pa)
)));
});
}In the above example, each file would have a status line with the
name of the file, and by pushing FooterWidgets, you will push
a StatusLine, PromptLine and Notifications combo to
each window. This StatusLine will point to the currently
active File, instead of a specific one.
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:
setup_duat!(setup);
use duat::prelude::*;
fn setup() {
hook::remove("FileWidgets");
hook::add::<File>(|_, (cfg, builder)| {
builder.push(LineNumbers::cfg());
builder.push(StatusLine::cfg().above());
cfg
});
}