Major fixes:
- ChunkIterator is now bidirectional - LineIterator is now also bidirectional - Undo/redo history operations - Replace operation - Range based api functions - And more minor bug fixes
This commit is contained in:
@@ -3,14 +3,20 @@
|
||||
#include "../shard.h"
|
||||
#include "pch.h"
|
||||
|
||||
enum struct Direction : uint8_t {
|
||||
Forward,
|
||||
Backward
|
||||
};
|
||||
|
||||
struct ChunkIterator {
|
||||
Direction dir;
|
||||
Shard *root = nullptr;
|
||||
std::vector<Shard *> stack;
|
||||
Petal *petal = nullptr;
|
||||
uint32_t petal_offset = 0;
|
||||
uint32_t global_offset;
|
||||
uint32_t global_offset = 0;
|
||||
|
||||
ChunkIterator(Shard *r);
|
||||
ChunkIterator(Shard *r, Direction dir);
|
||||
|
||||
~ChunkIterator();
|
||||
|
||||
|
||||
@@ -6,14 +6,12 @@
|
||||
|
||||
struct LineIterator {
|
||||
ChunkIterator it;
|
||||
Direction dir;
|
||||
|
||||
const char *cursor = nullptr;
|
||||
bool eof = false;
|
||||
uint32_t remaining = 0;
|
||||
uint32_t line_offset = 0;
|
||||
|
||||
LineIterator(Shard *r, uint32_t start_line);
|
||||
const char *chunk;
|
||||
uint32_t len;
|
||||
|
||||
LineIterator(Shard *r, uint32_t start_line, Direction dir);
|
||||
~LineIterator() = default;
|
||||
|
||||
bool next(std::string &line);
|
||||
|
||||
Reference in New Issue
Block a user