aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/input/handler.rs
diff options
context:
space:
mode:
authordenis <denismaximov98@gmail.com>2021-05-01 14:44:43 +0300
committerdenis <denismaximov98@gmail.com>2021-05-01 14:44:43 +0300
commitf85822972ad6ed19f94bc1b30a7120bcd4b091e0 (patch)
tree7b65e9da4d56a9c87ab5829a6389ac28133cf940 /src/common/input/handler.rs
parentchore: painless merge this time (diff)
downloadsl0ppij-f85822972ad6ed19f94bc1b30a7120bcd4b091e0.tar.gz
sl0ppij-f85822972ad6ed19f94bc1b30a7120bcd4b091e0.tar.xz
sl0ppij-f85822972ad6ed19f94bc1b30a7120bcd4b091e0.zip
chore: cleanup, fix: the tests finally pass
Diffstat (limited to 'src/common/input/handler.rs')
-rw-r--r--src/common/input/handler.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/common/input/handler.rs b/src/common/input/handler.rs
index eda71eea..b5f6008a 100644
--- a/src/common/input/handler.rs
+++ b/src/common/input/handler.rs
@@ -2,7 +2,7 @@
use super::actions::Action;
use super::keybinds::Keybinds;
-use crate::common::input::config::Config;
+use crate::common::{input::config::Config};
use crate::common::{AppInstruction, SenderWithContext, OPENCALLS};
use crate::errors::ContextType;
use crate::os_input_output::OsApi;
@@ -11,9 +11,8 @@ use crate::screen::ScreenInstruction;
use crate::wasm_vm::PluginInstruction;
use crate::CommandIsExecuting;
-use crate::common::utils::shared::load_palette;
use termion::input::{TermRead, TermReadEventsAndRaw};
-use zellij_tile::data::{Event, InputMode, Key, ModeInfo};
+use zellij_tile::data::{Event, InputMode, Key, ModeInfo, Palette};
/// Handles the dispatching of [`Action`]s according to the current
/// [`InputMode`], and keep tracks of the current [`InputMode`].
@@ -132,11 +131,14 @@ impl InputHandler {
self.send_plugin_instructions
.send(PluginInstruction::Update(
None,
- Event::ModeUpdate(get_mode_info(mode)),
+ Event::ModeUpdate(get_mode_info(mode, self.os_input.load_palette())),
))
.unwrap();
self.send_screen_instructions
- .send(ScreenInstruction::ChangeMode(get_mode_info(mode)))
+ .send(ScreenInstruction::ChangeMode(get_mode_info(
+ mode,
+ self.os_input.load_palette(),
+ )))
.unwrap();
self.send_screen_instructions
.send(ScreenInstruction::Render)
@@ -285,9 +287,8 @@ impl InputHandler {
/// Creates a [`Help`] struct indicating the current [`InputMode`] and its keybinds
/// (as pairs of [`String`]s).
// TODO this should probably be automatically generated in some way
-pub fn get_mode_info(mode: InputMode) -> ModeInfo {
+pub fn get_mode_info(mode: InputMode, palette: Palette) -> ModeInfo {
let mut keybinds: Vec<(String, String)> = vec![];
- let palette = load_palette();
match mode {
InputMode::Normal | InputMode::Locked => {}
InputMode::Resize => {