r3bl_tui/tui/terminal_window/default_input_handler.rs
1// Copyright (c) 2022-2025 R3BL LLC. Licensed under Apache License, Version 2.0.
2
3use crate::{Continuation, InputEvent};
4
5#[derive(Debug)]
6pub struct DefaultInputEventHandler;
7
8impl DefaultInputEventHandler {
9 /// This function does **not** consume the `input_event` argument. [`InputEvent`]
10 /// implements [Copy] (no need to pass references into this function).
11 #[must_use]
12 #[allow(clippy::needless_pass_by_value)]
13 pub fn no_consume(input_event: InputEvent, exit_keys: &[InputEvent]) -> Continuation {
14 // Early return if any request_shutdown key sequence is pressed.
15 if input_event.matches(exit_keys) {
16 return Continuation::Stop;
17 }
18 Continuation::Continue
19 }
20}