toolchain: add new debugging tool using magenta_debug

This commit is contained in:
2026-06-06 17:54:20 +01:00
parent 5bb36a916c
commit a6bdcc6c49
40 changed files with 2211 additions and 1 deletions
+44
View File
@@ -0,0 +1,44 @@
#include "buffer.h"
#include "line-ed.h"
#include <fx/stringstream.h>
#include <fx/wstr.h>
const fx_wchar *line_start(struct line_ed *ed, size_t y)
{
const fx_wchar *line = ed->l_buf;
for (size_t i = 0; i < y; i++) {
line += fx_wstrcspn(line, L"\n");
if (*line == '\n') {
line++;
}
}
return line;
}
size_t line_length(struct line_ed *ed, size_t y)
{
const fx_wchar *line = ed->l_buf;
for (size_t i = 0; i < y; i++) {
line += fx_wstrcspn(line, L"\n");
if (*line == '\n') {
line++;
}
}
if (*line == '\0') {
return 0;
}
size_t len = fx_wstrcspn(line, L"\n");
if (line[len] == '\n') {
len++;
}
return len;
}