chiark / gitweb /
Pass client through to handle_keypress.
authorSimon Tatham <anakin@pobox.com>
Fri, 29 Dec 2023 16:05:30 +0000 (16:05 +0000)
committerSimon Tatham <anakin@pobox.com>
Fri, 29 Dec 2023 18:17:34 +0000 (18:17 +0000)
src/file.rs
src/menu.rs
src/tui.rs

index 1719fe3d136bf6ab438e962ce4878bfd9ffb86a5..da20f717bcc6e77a5a84b52f094752a246e12da5 100644 (file)
@@ -57,7 +57,9 @@ impl ActivityState for FeedFile {
         (lines, CursorPosition::None) // FIXME
     }
 
-    fn handle_keypress(&mut self, _key: OurKey) -> LogicalAction {
+    fn handle_keypress(&mut self, _key: OurKey, _client: &mut Client) ->
+        LogicalAction
+    {
         LogicalAction::Nothing // FIXME
     }
 }
index d5be77a79216d9fccf257756e15779be4a0f0a79..18c4fe494bb6111ef1d0d702b82343698f277fec 100644 (file)
@@ -3,6 +3,7 @@ use std::cmp::max;
 use itertools::Itertools;
 
 use super::activity_stack::{NonUtilityActivity, UtilityActivity};
+use super::client::Client;
 use super::coloured_string::ColouredString;
 use super::text::*;
 use super::tui::{
@@ -169,7 +170,9 @@ impl ActivityState for Menu {
         (lines, CursorPosition::End)
     }
 
-    fn handle_keypress(&mut self, key: OurKey) -> LogicalAction {
+    fn handle_keypress(&mut self, key: OurKey, _client: &mut Client) ->
+        LogicalAction
+    {
         match self.actions.get(&key) {
             Some(action) => action.clone(),
             None => LogicalAction::Nothing,
index ab11d73dc43799b7cdf95c38f9403faddf570f0b..c7869cd5ba88a8b1bc8ee67996e31d47da9b0742 100644 (file)
@@ -338,8 +338,10 @@ pub enum LogicalAction {
 }
 
 pub trait ActivityState {
-    fn draw(&self, w: usize, h: usize) -> (Vec<ColouredString>, CursorPosition);
-    fn handle_keypress(&mut self, key: OurKey) -> LogicalAction;
+    fn draw(&self, w: usize, h: usize) ->
+        (Vec<ColouredString>, CursorPosition);
+    fn handle_keypress(&mut self, key: OurKey, client: &mut Client) ->
+        LogicalAction;
 }
 
 struct TuiLogicalState {
@@ -414,7 +416,7 @@ impl TuiLogicalState {
             OurKey::Escape => LogicalAction::Goto(
                 UtilityActivity::UtilsMenu.into()),
 
-            _ => self.activity_state.handle_keypress(key),
+            _ => self.activity_state.handle_keypress(key, client),
         };
 
         match logact {