Major updates:
- A lotta cleanup - BEd command parser rewrite - Vase class removed - Proper IO system. - A lot more.
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
#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
|
||||
@@ -11,7 +11,7 @@ struct KeyEvent {
|
||||
RESIZE
|
||||
};
|
||||
enum struct KeyType {
|
||||
NONE,
|
||||
EOF_,
|
||||
CHAR,
|
||||
SPECIAL,
|
||||
MOUSE,
|
||||
@@ -38,7 +38,7 @@ struct KeyEvent {
|
||||
RELEASE
|
||||
};
|
||||
|
||||
KeyType type = KeyType::NONE;
|
||||
KeyType type = KeyType::EOF_;
|
||||
std::string text;
|
||||
|
||||
SpecialKey special_key = SpecialKey::UNKNOWN;
|
||||
@@ -67,6 +67,8 @@ struct IO {
|
||||
std::pair<std::string, bool> get_text(BEd &);
|
||||
|
||||
KeyEvent read_key();
|
||||
void write(const char *, uint64_t);
|
||||
void write(std::string_view);
|
||||
|
||||
private:
|
||||
static termios orig_termios;
|
||||
|
||||
Reference in New Issue
Block a user