Provides editor buffer facilities for this project.
Package: editor.buffer
Reachable from entry: no
std/fs.mlasfs→../MiniLangCompilerML/std/fs.ml— external dependencystd/string.mlass→../MiniLangCompilerML/std/string.ml— external dependency
function _insert_line(buf, idx, text)Insert a line into the buffer at a clamped index.
| Parameter | Type | Default | Description |
|---|---|---|---|
buf |
dynamic |
— | buf value consumed by this operation. |
idx |
dynamic |
— | idx value consumed by this operation. |
text |
dynamic |
— | Text consumed by the operation. |
function _lines_from_text(text)Split normalized text into editable buffer lines.
| Parameter | Type | Default | Description |
|---|---|---|---|
text |
dynamic |
— | Text consumed by the operation. |
function _normalize_text(text)Normalize line endings to MiniIDE internal newline format.
| Parameter | Type | Default | Description |
|---|---|---|---|
text |
dynamic |
— | Text consumed by the operation. |
function _remove_line(buf, idx)Remove one line while keeping the buffer non-empty.
| Parameter | Type | Default | Description |
|---|---|---|---|
buf |
dynamic |
— | buf value consumed by this operation. |
idx |
dynamic |
— | idx value consumed by this operation. |
function _set_line(buf, idx, text)Replace one buffer line and mark the buffer dirty.
| Parameter | Type | Default | Description |
|---|---|---|---|
buf |
dynamic |
— | buf value consumed by this operation. |
idx |
dynamic |
— | idx value consumed by this operation. |
text |
dynamic |
— | Text consumed by the operation. |
function _text_from_lines(lines)Join buffer lines back into normalized text.
| Parameter | Type | Default | Description |
|---|---|---|---|
lines |
dynamic |
— | lines value consumed by this operation. |
function backspace(buf)Delete the character before the cursor or merge with the previous line.
| Parameter | Type | Default | Description |
|---|---|---|---|
buf |
dynamic |
— | buf value consumed by this operation. |
function clamp_cursor(buf)Clamp cursor and scroll fields so they stay within the buffer.
| Parameter | Type | Default | Description |
|---|---|---|---|
buf |
dynamic |
— | buf value consumed by this operation. |
function current_line(buf)Return the current cursor line from a text buffer.
| Parameter | Type | Default | Description |
|---|---|---|---|
buf |
dynamic |
— | buf value consumed by this operation. |
function delete_forward(buf)Delete forward.
| Parameter | Type | Default | Description |
|---|---|---|---|
buf |
dynamic |
— | buf value consumed by this operation. |
function ensure_cursor_visible(buf, visible_lines)Ensure cursor visible.
| Parameter | Type | Default | Description |
|---|---|---|---|
buf |
dynamic |
— | buf value consumed by this operation. |
visible_lines |
dynamic |
— | visible_lines value consumed by this operation. |
function insert_text(buf, text)Insert text at the current cursor position.
| Parameter | Type | Default | Description |
|---|---|---|---|
buf |
dynamic |
— | buf value consumed by this operation. |
text |
dynamic |
— | Text consumed by the operation. |
function line_count(buf)Return the number of lines in a text buffer.
| Parameter | Type | Default | Description |
|---|---|---|---|
buf |
dynamic |
— | buf value consumed by this operation. |
function load_file(path)Load a file into a normalized text buffer.
| Parameter | Type | Default | Description |
|---|---|---|---|
path |
dynamic |
— | Path of the file or directory used by the operation. |
function move_down(buf)Move down.
| Parameter | Type | Default | Description |
|---|---|---|---|
buf |
dynamic |
— | buf value consumed by this operation. |
function move_end(buf)Move end.
| Parameter | Type | Default | Description |
|---|---|---|---|
buf |
dynamic |
— | buf value consumed by this operation. |
function move_home(buf)Move home.
| Parameter | Type | Default | Description |
|---|---|---|---|
buf |
dynamic |
— | buf value consumed by this operation. |
function move_left(buf)Move left.
| Parameter | Type | Default | Description |
|---|---|---|---|
buf |
dynamic |
— | buf value consumed by this operation. |
function move_right(buf)Move right.
| Parameter | Type | Default | Description |
|---|---|---|---|
buf |
dynamic |
— | buf value consumed by this operation. |
function move_up(buf)Move up.
| Parameter | Type | Default | Description |
|---|---|---|---|
buf |
dynamic |
— | buf value consumed by this operation. |
function new_buffer(path, text)Create a normalized text buffer for a path and initial contents.
| Parameter | Type | Default | Description |
|---|---|---|---|
path |
dynamic |
— | Path of the file or directory used by the operation. |
text |
dynamic |
— | Text consumed by the operation. |
function newline(buf)Split the current line at the cursor and move to the new line.
| Parameter | Type | Default | Description |
|---|---|---|---|
buf |
dynamic |
— | buf value consumed by this operation. |
function save(buf)Persist a text buffer to disk and clear its dirty flag on success.
| Parameter | Type | Default | Description |
|---|---|---|---|
buf |
dynamic |
— | buf value consumed by this operation. |
function scroll(buf, delta)Return the scroll.
| Parameter | Type | Default | Description |
|---|---|---|---|
buf |
dynamic |
— | buf value consumed by this operation. |
delta |
dynamic |
— | delta value consumed by this operation. |
function set_cursor(buf, line, col)Set cursor.
| Parameter | Type | Default | Description |
|---|---|---|---|
buf |
dynamic |
— | buf value consumed by this operation. |
line |
dynamic |
— | line value consumed by this operation. |
col |
dynamic |
— | col value consumed by this operation. |
- editor.buffer.TextBuffer — struct
function word_prefix(buf)Return the word prefix.
| Parameter | Type | Default | Description |
|---|---|---|---|
buf |
dynamic |
— | buf value consumed by this operation. |