Fix minor bugs and add language detection.
This commit is contained in:
@@ -33,7 +33,7 @@ struct Buffer {
|
||||
virtual bool waste() = 0;
|
||||
virtual uint64_t lines() = 0;
|
||||
virtual uint64_t bytes() = 0;
|
||||
virtual void set_filename(std::filesystem::path path) = 0;
|
||||
virtual void set_filename(BEd &ctx, std::filesystem::path path) = 0;
|
||||
virtual std::filesystem::path filename() = 0;
|
||||
virtual void saved_hook() = 0;
|
||||
virtual void load(BEd &ctx, vase::Shard *text) = 0;
|
||||
|
||||
@@ -14,7 +14,7 @@ struct ClipBuffer : Buffer {
|
||||
uint64_t lines() override;
|
||||
uint64_t bytes() override;
|
||||
void load(BEd &ctx, vase::Shard *text) override;
|
||||
void set_filename(std::filesystem::path path) override;
|
||||
void set_filename(BEd &ctx, std::filesystem::path path) override;
|
||||
std::filesystem::path filename() override;
|
||||
vase::Shard *copy(uint64_t start_line, uint64_t end_line) override;
|
||||
void substitute(
|
||||
|
||||
@@ -34,7 +34,7 @@ struct GenericBuffer : ShardBuffer {
|
||||
void saved_hook() override;
|
||||
bool waste() override;
|
||||
void load(BEd &ctx, vase::Shard *text) override;
|
||||
void set_filename(std::filesystem::path path) override;
|
||||
void set_filename(BEd &ctx, std::filesystem::path path) override;
|
||||
std::filesystem::path filename() override;
|
||||
void substitute(
|
||||
BEd &ctx, uint64_t start_line, uint64_t end_line,
|
||||
|
||||
@@ -19,7 +19,7 @@ struct ReadonlyBuffer : ShardBuffer {
|
||||
void load(BEd &, vase::Shard *) override {
|
||||
throw ed_error("This buffer is read-only.");
|
||||
}
|
||||
void set_filename(std::filesystem::path) override {}
|
||||
void set_filename(BEd &, std::filesystem::path) override {}
|
||||
std::filesystem::path filename() override {
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
#include "storage/storage.h"
|
||||
|
||||
namespace bed::internal::vase {
|
||||
// TODO: rewrite with invariant, text ends with a newline, as right now both 1 real and empty line and no text mean teh same thing,
|
||||
// which causes a ton of issues.
|
||||
|
||||
struct Shard {
|
||||
enum struct Kind : uint8_t {
|
||||
Branch,
|
||||
|
||||
Reference in New Issue
Block a user