Files
kte/InputHandler.h
Kyle Isom 45b2b88623 Code quality, safety, stability, and cleanups.
- Replace header include guards with `#pragma once` and perform minor optimizations.
- Replaced traditional include guards with `#pragma once` for simplicity and to reduce boilerplate in all headers.
- Improved CLI line number handling with clamping and error messaging.
- Enhanced `chdir` error handling for macOS GUI builds.
- Removed redundant logic for GUI builds.
- Adjusted font constructor and registry to handle `const` data pointers consistently.
2025-12-03 14:02:54 -08:00

25 lines
655 B
C++

/*
* InputHandler.h - input abstraction and mapping to commands
*/
#pragma once
#include <string>
#include "Command.h"
// Result of translating raw input into an editor command.
struct MappedInput {
bool hasCommand = false;
CommandId id = CommandId::Refresh;
std::string arg; // optional argument (e.g., text for InsertText)
int count = 0; // optional repeat (C-u not yet implemented)
};
class InputHandler {
public:
virtual ~InputHandler() = default;
// Poll for input and translate it to a command. Non-blocking.
// Returns true if a command is available in 'out'. Returns false if no input.
virtual bool Poll(MappedInput &out) = 0;
};