mirror of
https://github.com/xvxx/phetch
synced 2024-11-12 13:10:40 +00:00
fix status clearing
This commit is contained in:
parent
6690372441
commit
7943a7210a
17
src/ui.rs
17
src/ui.rs
@ -91,7 +91,6 @@ impl UI {
|
|||||||
self.render_status().unwrap_or_else(|| "".into()),
|
self.render_status().unwrap_or_else(|| "".into()),
|
||||||
);
|
);
|
||||||
|
|
||||||
self.status.clear();
|
|
||||||
self.dirty = false;
|
self.dirty = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,8 +106,6 @@ impl UI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn open(&mut self, url: &str) -> Result<()> {
|
pub fn open(&mut self, url: &str) -> Result<()> {
|
||||||
self.status.clear();
|
|
||||||
|
|
||||||
// no open loops
|
// no open loops
|
||||||
if let Some(page) = self.views.get(self.focused) {
|
if let Some(page) = self.views.get(self.focused) {
|
||||||
if page.url() == url {
|
if page.url() == url {
|
||||||
@ -323,14 +320,18 @@ impl UI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn process_action(&mut self, action: Action) -> Result<()> {
|
fn process_action(&mut self, action: Action) -> Result<()> {
|
||||||
|
let cleared = if !self.status.is_empty() {
|
||||||
|
self.status.clear();
|
||||||
|
self.dirty = true;
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
};
|
||||||
|
|
||||||
match action {
|
match action {
|
||||||
Action::Keypress(Key::Esc) => self.status.clear(),
|
|
||||||
Action::Keypress(Key::Ctrl('c')) => {
|
Action::Keypress(Key::Ctrl('c')) => {
|
||||||
if self.status.is_empty() {
|
if !cleared {
|
||||||
self.running = false
|
self.running = false
|
||||||
} else {
|
|
||||||
self.dirty = true;
|
|
||||||
self.status.clear();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Action::Keypress(Key::Ctrl('q')) => self.running = false,
|
Action::Keypress(Key::Ctrl('q')) => self.running = false,
|
||||||
|
Loading…
Reference in New Issue
Block a user