Major updates:

- A lotta cleanup
- BEd command parser rewrite
- Vase class removed
- Proper IO system.
- A lot more.
This commit is contained in:
2026-08-29 22:30:01 +01:00
parent d7278251ec
commit b8eac7b2da
42 changed files with 2153 additions and 1733 deletions
+26 -23
View File
@@ -1,55 +1,58 @@
#pragma once
#include "internal/buffer/buffer.h"
#include "pch.h"
namespace bed::internal::marks {
struct MarksEngine {
uint64_t marks[256];
buffer::Line marks[256];
MarksEngine() {
for (auto &m : marks)
m = UINT64_MAX;
m = {"", UINT64_MAX};
}
uint64_t get(uint8_t m) {
buffer::Line &get(uint8_t m) {
return marks[m];
}
void set(uint8_t m, uint64_t line) {
marks[m] = line;
}
void insert(uint64_t start, uint64_t count) {
void insert(std::string bufname, uint64_t start, uint64_t count) {
for (uint16_t i = 0; i <= UINT8_MAX; ++i) {
if (marks[i] == UINT64_MAX)
if (marks[i].buffername != bufname)
continue;
if (marks[i] >= start)
marks[i] += count;
if (marks[i].number == UINT64_MAX)
continue;
if (marks[i].number >= start)
marks[i].number += count;
}
}
void erase(uint64_t start, uint64_t count) {
void erase(std::string bufname, uint64_t start, uint64_t count) {
for (uint16_t i = 0; i <= UINT8_MAX; ++i) {
if (marks[i] == UINT64_MAX)
if (marks[i].buffername != bufname)
continue;
if (marks[i] >= start) {
if (marks[i] < start + count)
marks[i] = UINT64_MAX;
if (marks[i].number == UINT64_MAX)
continue;
if (marks[i].number >= start) {
if (marks[i].number < start + count)
marks[i].number = UINT64_MAX;
else
marks[i] -= count;
marks[i].number -= count;
}
}
}
void collapse(uint64_t start, uint64_t count) {
void collapse(std::string bufname, uint64_t start, uint64_t count) {
for (uint16_t i = 0; i <= UINT8_MAX; ++i) {
if (marks[i] == UINT64_MAX)
if (marks[i].buffername != bufname)
continue;
if (marks[i] >= start) {
if (marks[i] < start + count)
marks[i] = start;
if (marks[i].number == UINT64_MAX)
continue;
if (marks[i].number >= start) {
if (marks[i].number < start + count)
marks[i].number = start;
else
marks[i] -= count;
marks[i].number -= count;
}
}
}