fix: add luks prompt to fix broken on external keyboard
This commit is contained in:
1 parent
0c30e71261
commit
d0bffd5dac
19 files changed
+574
-105
No files matched your search
@@ -0,0 +1,41 @@
|
||||
use ratatui::{
|
||||
buffer::Buffer,
|
||||
layout::Rect,
|
||||
style::Stylize,
|
||||
text::Line,
|
||||
widgets::{Paragraph, Widget},
|
||||
};
|
||||
|
||||
use super::rule;
|
||||
use crate::{glyphs::Glyphs, palette::Palette};
|
||||
|
||||
pub struct PasswordPrompt<'a> {
|
||||
pub message: &'a str,
|
||||
pub input: String,
|
||||
pub sent: bool,
|
||||
}
|
||||
|
||||
pub struct PasswordBar<'a> {
|
||||
pub asking: &'a PasswordPrompt<'a>,
|
||||
pub palette: &'a Palette,
|
||||
pub glyphs: &'a Glyphs,
|
||||
}
|
||||
|
||||
impl Widget for PasswordBar<'_> {
|
||||
fn render(self, area: Rect, buf: &mut Buffer) {
|
||||
let status = if self.asking.sent {
|
||||
format!(" checking{}", self.glyphs.ellipsis).fg(self.palette.waiting)
|
||||
} else {
|
||||
format!(" {}_", self.asking.input).fg(self.palette.text)
|
||||
};
|
||||
Paragraph::new(Line::from(vec![
|
||||
self.asking.message.fg(self.palette.running).bold(),
|
||||
status,
|
||||
]))
|
||||
.block(rule(
|
||||
self.palette,
|
||||
Line::from(" password ".fg(self.palette.running)),
|
||||
))
|
||||
.render(area, buf);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user