This commit is contained in:
2026-08-30 12:51:11 +01:00
parent b8eac7b2da
commit afa60dd12f
24 changed files with 821 additions and 803 deletions
-48
View File
@@ -1,48 +0,0 @@
#pragma once
#include "internal/io/io.h"
#include "internal/ui/autocomp.h"
#include "pch.h"
namespace bed::internal::io {
struct Token {
enum struct Type : uint8_t {
TempCurrent, // @
AddressSeperator, // ; ,
Address, // . $ % [ ] ^ ~
Offset, // +N -N + -
AddressRegex, // /re/ ?re?
AddressSymbol, // >s> <s< <s>
Number, // 10
Mark, // 'm
RubyFunction, // (func:arg)
RubyArg,
Function,
Any,
Shell,
Ruby,
File,
Regex,
Replacement,
Suffix
} type;
uint16_t start;
uint16_t end;
};
struct CommandIO {
std::string cmd;
uint16_t cursor;
std::string prompt;
uint16_t start;
uint16_t height;
uint16_t term_height;
uint16_t term_width;
BEd &bed;
IO &io;
CommandIO(BEd &, IO &);
std::pair<std::string, bool> run();
void redraw();
};
} // namespace bed::internal::io
+8 -7
View File
@@ -50,6 +50,14 @@ struct KeyEvent {
};
struct IO {
static termios orig_termios;
static termios raw_termios;
static bool cleaned;
static void cleanup();
static void enable_raw();
static volatile std::atomic_bool resized;
static void handle_sigwinch(int);
IO();
~IO();
@@ -70,13 +78,6 @@ struct IO {
void write(const char *, uint64_t);
void write(std::string_view);
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;
KeyEvent::ReadResult get_next_byte(char &out);