mirror of
https://github.com/xvxx/phetch
synced 2024-11-05 00:00:58 +00:00
no bg on input prompt
This commit is contained in:
parent
724849e50f
commit
7379b1b528
25
src/menu.rs
25
src/menu.rs
@ -177,11 +177,10 @@ impl Menu {
|
||||
|
||||
fn render_input(&self) -> String {
|
||||
format!(
|
||||
"{}{}{}find:\x1b[0m {}{}",
|
||||
"{}Find:\x1b[0m {}{}{}",
|
||||
termion::cursor::Goto(1, self.rows() as u16),
|
||||
color::Bg(color::White),
|
||||
color::Fg(color::Black),
|
||||
self.input,
|
||||
termion::cursor::Show,
|
||||
termion::clear::AfterCursor,
|
||||
)
|
||||
}
|
||||
@ -190,7 +189,7 @@ impl Menu {
|
||||
if self.searching {
|
||||
print!("{}", self.render_input());
|
||||
} else {
|
||||
print!("{}", termion::clear::CurrentLine);
|
||||
print!("{}{}", termion::clear::CurrentLine, termion::cursor::Hide);
|
||||
}
|
||||
stdout().flush();
|
||||
Action::None
|
||||
@ -540,19 +539,13 @@ impl Menu {
|
||||
Action::Keypress(key)
|
||||
}
|
||||
}
|
||||
Key::Esc => {
|
||||
Key::Esc | Key::Ctrl('c') => {
|
||||
if self.searching {
|
||||
self.searching = false;
|
||||
self.input.clear();
|
||||
self.redraw_input()
|
||||
} else {
|
||||
Action::Keypress(key)
|
||||
}
|
||||
}
|
||||
Key::Ctrl('c') => {
|
||||
if self.searching {
|
||||
self.searching = false;
|
||||
self.input.clear();
|
||||
if self.input.is_empty() {
|
||||
self.searching = false;
|
||||
} else {
|
||||
self.input.clear();
|
||||
}
|
||||
self.redraw_input()
|
||||
} else {
|
||||
Action::Keypress(key)
|
||||
|
Loading…
Reference in New Issue
Block a user