Improve command input and adding resize handling.
This commit is contained in:
@@ -5,12 +5,18 @@
|
||||
|
||||
namespace bed::internal::io {
|
||||
struct KeyEvent {
|
||||
enum struct ReadResult {
|
||||
SUCCESS,
|
||||
EOF_,
|
||||
RESIZE
|
||||
};
|
||||
enum struct KeyType {
|
||||
NONE,
|
||||
CHAR,
|
||||
SPECIAL,
|
||||
MOUSE,
|
||||
PASTE
|
||||
PASTE,
|
||||
RESIZE
|
||||
};
|
||||
enum struct SpecialKey {
|
||||
UP,
|
||||
@@ -58,6 +64,7 @@ struct IO {
|
||||
void move_cursor(uint16_t row, uint16_t col);
|
||||
|
||||
std::pair<std::string, bool> get_command(BEd &);
|
||||
std::pair<std::string, bool> get_text(BEd &);
|
||||
|
||||
KeyEvent read_key();
|
||||
|
||||
@@ -65,15 +72,17 @@ private:
|
||||
static termios orig_termios;
|
||||
static bool cleaned;
|
||||
static void cleanup();
|
||||
static volatile std::atomic_bool resized;
|
||||
static void handle_sigwinch(int);
|
||||
|
||||
std::deque<char> input_queue;
|
||||
|
||||
bool get_next_byte(char &out);
|
||||
KeyEvent::ReadResult get_next_byte(char &out);
|
||||
void enqueue_bytes(const std::string &bytes);
|
||||
static int utf8_seq_len(uint8_t byte);
|
||||
|
||||
std::string read_next_unit();
|
||||
bool read_bracketed_paste(std::string &out);
|
||||
KeyEvent::ReadResult read_next_unit(std::string &out);
|
||||
KeyEvent::ReadResult read_bracketed_paste(std::string &out);
|
||||
|
||||
KeyEvent parse_mouse(const std::string &buf);
|
||||
KeyEvent parse_escape(const std::string &buf);
|
||||
|
||||
Reference in New Issue
Block a user