Add a minibuffer #131
@ -354,17 +354,18 @@ struct Minibuffer<'a> {
|
|||||||
|
|
||||||
impl Minibuffer<'_> {
|
impl Minibuffer<'_> {
|
||||||
fn paragraphs(state: &AppPublicState) -> Self {
|
fn paragraphs(state: &AppPublicState) -> Self {
|
||||||
match state {
|
let columns = 3;
|
||||||
|
let mb = match state {
|
||||||
AppState::Browse(_) => Minibuffer {
|
AppState::Browse(_) => Minibuffer {
|
||||||
paragraphs: vec![
|
paragraphs: vec![
|
||||||
Paragraph::new("m: show info overlay"),
|
Paragraph::new("m: show info overlay"),
|
||||||
Paragraph::new("g: show reload menu"),
|
Paragraph::new("g: show reload menu"),
|
||||||
],
|
],
|
||||||
columns: 3,
|
columns,
|
||||||
},
|
},
|
||||||
AppState::Info(_) => Minibuffer {
|
AppState::Info(_) => Minibuffer {
|
||||||
paragraphs: vec![Paragraph::new("m: hide info overlay")],
|
paragraphs: vec![Paragraph::new("m: hide info overlay")],
|
||||||
columns: 3,
|
columns,
|
||||||
},
|
},
|
||||||
AppState::Reload(_) => Minibuffer {
|
AppState::Reload(_) => Minibuffer {
|
||||||
paragraphs: vec![
|
paragraphs: vec![
|
||||||
@ -372,17 +373,23 @@ impl Minibuffer<'_> {
|
|||||||
Paragraph::new("d: reload database"),
|
Paragraph::new("d: reload database"),
|
||||||
Paragraph::new("l: reload library"),
|
Paragraph::new("l: reload library"),
|
||||||
],
|
],
|
||||||
columns: 3,
|
columns,
|
||||||
},
|
},
|
||||||
AppState::Error(_) => Minibuffer {
|
AppState::Error(_) => Minibuffer {
|
||||||
paragraphs: vec![Paragraph::new("Press any key to dismiss the error message...")],
|
paragraphs: vec![Paragraph::new(
|
||||||
|
"Press any key to dismiss the error message...",
|
||||||
|
)],
|
||||||
columns: 1,
|
columns: 1,
|
||||||
},
|
},
|
||||||
AppState::Critical(_) => Minibuffer {
|
AppState::Critical(_) => Minibuffer {
|
||||||
paragraphs: vec![Paragraph::new("Press ctrl+c to terminate the program...")],
|
paragraphs: vec![Paragraph::new("Press ctrl+c to terminate the program...")],
|
||||||
columns: 1,
|
columns: 1,
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
|
|
||||||
|
// Callers will assume this.
|
||||||
|
assert!(mb.columns >= mb.paragraphs.len() as u16);
|
||||||
|
mb
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user