pub(crate) fn handle_key_input(
    app: &mut Application,
    key: KeyEvent,
) -> Result<bool, Box<dyn Error>> {
    match key.code {
        // Arrow key input
        KeyCode::Left => {
            app.key_handler.left(&mut app.data, &mut app.display, &mut app.labels);
        }
        KeyCode::Right => {
            app.key_handler.right(&mut app.data, &mut app.display, &mut app.labels);
        }
        KeyCode::Up => {
            app.key_handler.up(&mut app.data, &mut app.display, &mut app.labels);
        }
        KeyCode::Down => {
            app.key_handler.down(&mut app.data, &mut app.display, &mut app.labels);
        }

        // Cursor shortcuts
        KeyCode::Home => {
            app.key_handler.home(&mut app.data, &mut app.display, &mut app.labels);
        }
        KeyCode::End => {
            app.key_handler.end(&mut app.data, &mut app.display, &mut app.labels);
        }
        KeyCode::PageUp => {
            app.key_handler.page_up(&mut app.data, &mut app.display, &mut app.labels);
        }
        KeyCode::PageDown => {
            app.key_handler.page_down(&mut app.data, &mut app.display, &mut app.labels);
        }

        // Removals
        KeyCode::Backspace => {
            app.key_handler.backspace(&mut app.data, &mut app.display, &mut app.labels);
        }
        KeyCode::Delete => {
            app.key_handler.delete(&mut app.data, &mut app.display, &mut app.labels);
        }
        KeyCode::Esc => {
            app.focus_editor();
        }

        KeyCode::Enter => {
            if app.key_handler.is_focusing(Window::UnsavedChanges)
                && app.key_handler.get_user_input() == PopupOutput::Boolean(true)
            {
                return Ok(false);
            }
            app.key_handler.enter(&mut app.data, &mut app.display, &mut app.labels);
            app.focus_editor();
        }

        KeyCode::Char(char) => {
            // Because CNTRLq is the signal to quit, we propogate the message
            // if this handling method returns false
            return handle_character_input(app, char, key.modifiers);
        }
        _ => {}
    }
    Ok(true)
}
Wrapper function that calls the corresponding [`KeyHandler`](crate::windows::KeyHandler) methods of
[the application's `key_handler`.](Application::key_handler)
src/input.rs