This commit is contained in:
2026-07-28 02:57:13 +01:00
parent 737c6c1d20
commit 57dda2589e
14 changed files with 369 additions and 84 deletions
+24
View File
@@ -0,0 +1,24 @@
#include "vase/buffer/original.h"
const char *OriginalBuffer::read(uint32_t pos, uint32_t *out_len) {
if (pos >= length)
return nullptr;
*out_len = length - pos;
return buf + pos;
}
uint32_t OriginalBuffer::count_lines(uint32_t pos, uint32_t length) {
auto start = std::lower_bound(
newlines.begin(),
newlines.end(),
pos
);
auto end = std::lower_bound(
start,
newlines.end(),
pos + length
);
return (uint32_t)(end - start);
}