summaryrefslogtreecommitdiffstats
path: root/src/views/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/views/main.rs')
-rw-r--r--src/views/main.rs40
1 files changed, 2 insertions, 38 deletions
diff --git a/src/views/main.rs b/src/views/main.rs
index 2cf54c3..c42e417 100644
--- a/src/views/main.rs
+++ b/src/views/main.rs
@@ -18,8 +18,6 @@ use cursive::views::NamedView;
use cursive::views::ResizedView;
use getset::{Getters, MutGetters};
-use crate::bindings::BindingCaller;
-use crate::bindings::Bindings;
use crate::tabs::*;
use crate::runtime::Runtime;
@@ -31,18 +29,14 @@ pub struct MainView {
#[getset(get = "pub", get_mut = "pub")]
tabs: crate::tabs::Tabs,
-
- bindings: Bindings,
- bindings_caller: Option<ResizedView<NamedView<BindingCaller>>>,
}
impl MainView {
pub fn new(rt: Rc<Runtime>) -> Result<NamedView<Self>> {
let default_query = rt.config().notmuch_default_query();
let tabs = Tabs::new(default_query, rt.clone())?;
- let bindings = crate::bindings::get_bindings();
- Ok(MainView { rt, tabs, bindings, bindings_caller: None }.with_name(MAIN_VIEW_NAME))
+ Ok(MainView { rt, tabs }.with_name(MAIN_VIEW_NAME))
}
pub fn get_current_tab(&self) -> Option<&cursive_multiplex::Mux> {
@@ -82,9 +76,6 @@ impl MainView {
impl View for MainView {
fn draw(&self, printer: &Printer) {
self.tabs.draw(printer);
- if let Some(caller) = self.bindings_caller.as_ref() {
- caller.draw(printer);
- }
}
fn layout(&mut self, xy: XY<usize>) {
@@ -101,34 +92,7 @@ impl View for MainView {
fn on_event(&mut self, e: Event) -> EventResult {
debug!("Received event: {:?}", e);
- match self.bindings_caller.as_mut() {
- Some(caller) => match e {
- Event::Key(Key::Esc) => {
- self.bindings_caller = None;
- debug!("Escape. Resetting bindings caller.");
- EventResult::Consumed(None)
- },
- other => {
- debug!("Forwarding event to bindings caller");
- caller.on_event(other)
- },
- },
- None => match e {
- Event::Char(':') => {
- debug!(": -> Constructing bindings caller.");
- self.bindings_caller = Some({
- self.bindings.caller()
- .with_name(crate::bindings::BINDINGS_CALLER)
- .resized(SizeConstraint::Full, SizeConstraint::AtLeast(5))
- });
- EventResult::Consumed(None)
- },
- other => {
- debug!("Forwarding event to tabs");
- self.tabs.on_event(other)
- },
- }
- }
+ self.tabs.on_event(e)
}
fn call_on_any<'a>(&mut self, s: &Selector, tpl: &'a mut (dyn FnMut(&mut (dyn View + 'static)) + 'a)) {