| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| | |
|
| |
|
|
|
|
|
|
| |
- Skip unnecessary cwd resolution when realpath returns ENAMETOOLONG.
- Drop duplicate error-handling branches and route all failures
through bind_fail.
- Keep behavior unchanged while shaving a few lines and clarifying
the control flow.
|
| |
|
|
|
|
| |
This fetch moves raylib-specific logics to redr_raylib.c and
input_raylib.c from main routine. Each apis are defined in redr.h and
input.h respectively.
|
| | |
|
| |
|
|
|
| |
[minor]
fix perror("func: ") to perror("func")
|
| |
|
|
|
|
|
|
|
| |
Cursor initialization is now assumed to be handled by eb_init,
eliminating redundant resets in eb_load_file and improving separation
of concerns.
[minor]
add comment to struct ed_buf
|
| |
|
|
| |
len is size_t variable
|
| |
|
|
|
|
|
|
| |
On eb_backspace, when the upper line was non-null, line_cat followed
by line_free, and eb_delete_line only cleared the line_vec. However,
commit 2441e78 introduced an additional line_free in eb_delete_line to
fix a memory leak, which led to a double-free for that line. This
patch resolves that problem.
|
| |
|
|
| |
This patch removes the dependency on raylib when allocating memory.
|
| |
|
|
|
|
| |
The function eb_delete_line did not properly free the contents of the
entry when deleting an element from eb->line_vec. This patch fixes
that issue.
|
| |
|
|
|
|
|
|
|
| |
This patch removes the per-line cursor cache (`line->cursor`),
reducing implementation complexity. Vertical cursor movement (up/down)
now uniformly places the cursor at the beginning of the line, instead
of trying to restore the previous horizontal position. UX
considerations such as column preservation will be revisited after
core stabilization.
|
| |
|
|
|
|
|
|
| |
Previously, each character of a line was written using fputc in a
loop, resulting in millions of function calls for large lines and poor
write performance. Replaced with a single fwrite call per line,
significantly reducing overhead and improving save performance
dramatically.
|
| |
|
|
| |
This patch removes obsolated line_get_string on eb_save_file.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds `line_get_slice` and `eb_get_line_slice`, enabling
slice-style (pointer + length) access to line contents without
requiring materialization into a null-terminated string.
- `line_get_slice` returns either the original mmap'd buffer (if the
- line is lazy) or the materialized vector contents (if edited).
- `eb_get_line_slice` wraps `line_get_slice` to provide safe access at
- the editor buffer level. Update `line.h` and `editor.h` headers to
- declare the new functions. Minor documentation improvements to
- clarify "init", "modify", and "get" function categories.
This prepares the codebase for transitioning away from C-string
dependency where possible, improving efficiency and avoiding
unnecessary memory copies.
|
| |
|
|
|
|
|
|
|
| |
When eb_save_file is called, it opens the file with
fopen(eb->file_name, "w"). Since opening with "w" mode truncates the
file size to 0, accessing the memory region previously mmap-ed to that
file results in a SIGBUS error. To prevent this, the content is now
first written to a temporary file at /tmp/%s.tmpXXXXXX, and then
renamed to eb->file_name.
|
| |
|
|
| |
Just kill warnings.
|
| |
|
|
|
|
|
|
| |
By making eb_get_line a static function within editor.c and
introducing API wrappers that internally delegate to eb_get_line and
line_get_string, thereby avoiding direct exposure of the line
structure. Considering a future transition from C-style
null-terminated strings to explicit length-based string management.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Each `struct line` now holds a pointer (`origin`) to its corresponding
line in the mmap'd file, along with its length (`origin_len`). The
`vec` field is no longer allocated for each line during
`eb_load_file`.
Instead, actual memory allocation and copying into `vec` occurs only
when an edit is made or when `line_get_string` is called (since a C
string is required). This behavior is handled via the internal inline
function `edit_happen`.
Also implement `vec_cat_raw` to `line_cat` when lazy `src`.
[minor]
Remove unused debug messages in editor.c.
|
| | |
|
| |
|
|
| |
implement line_init_from_buf for this.
|
| | |
|
| |
|
|
|
| |
This reduces unnecessary per-byte branching by scanning for newlines
more efficiently when loading files.
|
| |
|
|
|
| |
[minor]
add check for eb_save_file when fopen fails.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the current design, `eb->cur_row` can range up to
`Vec_slinep_len(eb->line_vec)`, allowing insertion of a new line at
the end of the buffer. However, directly accessing this index caused
assertion failures, as the `eb_*` series of functions operate on an
abstracted structure, not the raw vector.
To resolve this, a new abstraction layer `eb_delete_line` was
introduced to handle boundary checks properly. The `eb_*` functions
now call `eb_delete_line` instead of accessing the vector directly.
Similarly, `line_get_last` was modified to return 0 when called on a
`NULL` (unallocated) line to avoid unnecessary assertions.
From now on, the `eb_*` series should only directly call vector macros
when absolutely necessary.
[minor]
Rename `eb_set_cur_next` and `eb_set_cur_back`
|
| |
|
|
|
| |
[minor]
move eb_free to front of file
|
| |
|
|
|
| |
eb_bind binds file path to the ed_buf, eb_load_file loads to the
buffer if exists and eb_save_file save the buffer to that path.
|
| |
|
|
|
| |
[minor]
add argc and argv to main routine.
|
| |
|
|
| |
since it calls MemFree instead of line_free.
|
| |
|