summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/history.rs41
1 files changed, 29 insertions, 12 deletions
diff --git a/src/history.rs b/src/history.rs
index e06762e..73ace52 100644
--- a/src/history.rs
+++ b/src/history.rs
@@ -6,6 +6,7 @@ use textmode::Textmode as _;
pub struct History {
size: (u16, u16),
entries: Vec<crate::util::Mutex<HistoryEntry>>,
+ escape: bool,
action: async_std::channel::Sender<crate::action::Action>,
}
@@ -16,6 +17,7 @@ impl History {
Self {
size: (24, 80),
entries: vec![],
+ escape: false,
action,
}
}
@@ -127,19 +129,34 @@ impl History {
key: textmode::Key,
idx: usize,
) -> bool {
- match key {
- textmode::Key::Ctrl(b'z') => {
- self.action
- .send(crate::action::Action::UpdateFocus(
- crate::state::Focus::Readline,
- ))
- .await
- .unwrap();
+ if self.escape {
+ match key {
+ textmode::Key::Ctrl(b'e') => {
+ self.send_process_input(idx, &key.into_bytes())
+ .await
+ .unwrap();
+ }
+ textmode::Key::Char('r') => {
+ self.action
+ .send(crate::action::Action::UpdateFocus(
+ crate::state::Focus::Readline,
+ ))
+ .await
+ .unwrap();
+ }
+ _ => {}
}
- key => {
- self.send_process_input(idx, &key.into_bytes())
- .await
- .unwrap();
+ self.escape = false;
+ } else {
+ match key {
+ textmode::Key::Ctrl(b'e') => {
+ self.escape = true;
+ }
+ key => {
+ self.send_process_input(idx, &key.into_bytes())
+ .await
+ .unwrap();
+ }
}
}
false