Fixes.
This commit is contained in:
+2
-1
@@ -4,11 +4,11 @@
|
||||
#include "internal/buffer/buffer.h"
|
||||
#include "internal/functions/functions.h"
|
||||
#include "internal/functions/suffixes.h"
|
||||
#include "internal/io/command.h"
|
||||
#include "internal/io/io.h"
|
||||
#include "internal/marks/marks.h"
|
||||
#include "internal/theme/theme.h"
|
||||
#include "internal/ui/autocomp.h"
|
||||
#include "internal/ui/command.h"
|
||||
#include "pch.h"
|
||||
|
||||
namespace bed {
|
||||
@@ -27,6 +27,7 @@ struct BEd {
|
||||
bool prompt_mode = true;
|
||||
std::function<std::string(BEd &)> prompt = nullptr;
|
||||
bool suppress_mode = false;
|
||||
bool temporary_current = false;
|
||||
std::string last_regex = "";
|
||||
std::string last_symbol = "";
|
||||
std::string last_replacement = "";
|
||||
|
||||
@@ -25,6 +25,8 @@ struct Buffer {
|
||||
~Buffer();
|
||||
|
||||
uint64_t lines();
|
||||
uint64_t bytes();
|
||||
void load(BEd &ctx, vase::Shard *text);
|
||||
vase::Shard *copy(uint64_t start_line, uint64_t end_line);
|
||||
void substitute(
|
||||
BEd &ctx, uint64_t start_line, uint64_t end_line,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -48,8 +48,8 @@ struct MarksEngine {
|
||||
continue;
|
||||
if (marks[i].number == UINT64_MAX)
|
||||
continue;
|
||||
if (marks[i].number >= start) {
|
||||
if (marks[i].number < start + count)
|
||||
if (marks[i].number > start) {
|
||||
if (marks[i].number <= start + count)
|
||||
marks[i].number = start;
|
||||
else
|
||||
marks[i].number -= count;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "internal/functions/functions.h"
|
||||
#include "internal/functions/suffixes.h"
|
||||
#include "internal/io/command.h"
|
||||
#include "internal/ui/command.h"
|
||||
#include "pch.h"
|
||||
|
||||
namespace bed::internal::parser {
|
||||
@@ -85,12 +85,12 @@ struct Parser {
|
||||
std::string_view cmd;
|
||||
uint16_t i;
|
||||
Command *command;
|
||||
std::vector<io::Token> *tokens;
|
||||
std::vector<ui::Token> *tokens;
|
||||
CompletionContext *completion;
|
||||
|
||||
explicit Parser(
|
||||
std::string_view cmd, BEd &bed, Command *command,
|
||||
std::vector<io::Token> *tokens, CompletionContext *completion
|
||||
std::vector<ui::Token> *tokens, CompletionContext *completion
|
||||
);
|
||||
|
||||
char peek(uint16_t = 0); // == \0 if at eof.
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
#include "pch.h"
|
||||
|
||||
namespace bed::internal::syntax {
|
||||
void dump_events(ParseState *node);
|
||||
|
||||
struct Parser {
|
||||
static constexpr uint64_t MAX_CHUNK = 512;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "internal/ui/autocomp.h"
|
||||
#include "pch.h"
|
||||
|
||||
namespace bed::internal::io {
|
||||
namespace bed::internal::ui {
|
||||
struct Token {
|
||||
enum struct Type : uint8_t {
|
||||
TempCurrent, // @
|
||||
@@ -39,10 +39,10 @@ struct CommandIO {
|
||||
uint16_t term_height;
|
||||
uint16_t term_width;
|
||||
BEd &bed;
|
||||
IO &io;
|
||||
io::IO &io;
|
||||
|
||||
CommandIO(BEd &, IO &);
|
||||
CommandIO(BEd &, io::IO &);
|
||||
std::pair<std::string, bool> run();
|
||||
void redraw();
|
||||
};
|
||||
} // namespace bed::internal::io
|
||||
} // namespace bed::internal::ui
|
||||
@@ -27,14 +27,12 @@ struct Shard {
|
||||
static Shard *from_file(const std::filesystem::path &path, bool posix_ending);
|
||||
static Shard *from_string(const char *data, uint64_t len, bool posix_ending);
|
||||
static Shard *from_command(const char *cmd, bool posix_ending);
|
||||
// static std::vector<Shard *> from_swap(std::filesystem::path &path, OriginalStorage *b);
|
||||
|
||||
static std::pair<Shard *, Shard *> split(Shard *n, uint64_t offset);
|
||||
static Shard *concat(Shard *a, Shard *b);
|
||||
static Shard *merge_leaves(Shard *a, Shard *b);
|
||||
static Shard *append(Shard *root, Shard *leaf);
|
||||
static Shard *build(Shard **pieces, uint64_t lo, uint64_t hi);
|
||||
static void dump(Shard *node, int depth = 0);
|
||||
};
|
||||
|
||||
struct Branch : Shard {
|
||||
|
||||
@@ -48,6 +48,7 @@ std::string to_string(Shard *root, Range range);
|
||||
|
||||
Shard *insert(AppendStorage *ap, Shard *root, Shard *text, uint64_t line);
|
||||
Shard *erase(Shard *root, uint64_t start, uint64_t end);
|
||||
Shard *join(Shard *root, uint64_t start, uint64_t end);
|
||||
Shard *copy(Shard *root, uint64_t start, uint64_t end);
|
||||
|
||||
uint64_t find_next(Shard *root, std::string_view pattern, uint64_t start);
|
||||
|
||||
Reference in New Issue
Block a user