| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| |
|
|
| |
Long time no see, I thought there was some problem at first.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixed draw offsets and added scroll guard to not to try draw
non-existing parts and produce this:
(gdb) bt
#0 0x00007ffff7daba3c in ?? () from /usr/lib64/libc.so.6
#1 0x00007ffff7d51bd6 in raise () from /usr/lib64/libc.so.6
#2 0x00007ffff7d3930d in abort () from /usr/lib64/libc.so.6
#3 0x00007ffff7d39275 in ?? () from /usr/lib64/libc.so.6
#4 0x000055555555d7a5 in Vec_slinep_get (v=0x555555ae1ea0, index=50) at editor.c:20
#5 0x000055555555d950 in eb_get_line (eb=0x555556479b50, index=50) at editor.c:67
#6 0x000055555555e18b in eb_get_line_slice (eb=0x555556479b50, pos=50, sl=0x7fffffffc6e0) at editor.c:255
#7 0x0000555555560c98 in view_eb_draw (veb=0x555556258100) at view.c:220
#8 0x00005555555607d9 in view_draw_under (root=0x555556689000) at view.c:155
#9 0x000055555555fc78 in main (argc=2, argv=0x7fffffffd8c8) at main.c:47
I mean... what I were doing last year? This is just unreadable.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch extracts the drawing logic from redr_raylib.c and moves it
into a new abstraction layer in view.c, introducing a tree-based view
system for UI rendering.
- view.c defines a hierarchical 'view' structure with polymorphic draw methods.
- root and ed_buf views are implemented as a proof of concept.
- redr.c (via redr.h) now exposes only backend rendering primitives (text, clear, measure).
- main.c is updated to instantiate and draw the view tree.
This separation clarifies the responsibilities between layout (view)
and rendering (redr) and prepares the system for future UI extensions
such as nested panels, split views, and overlays.
|
| |
|
|
|
|
| |
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.
|
| |
|
|
| |
- fix log_printf to not automatically insert newline
|
| |
|
|
|
|
|
|
| |
- Replaced log_set_level() with log_init() to allow stream configuration.
- log_fprintf() now uses an internal stream, defaulting to stdout.
[minor]
update log tags in TODO.org correctly
|
| |
|
|
|
| |
- refactor enums in LOG_* to RED_LOG_* since its conflicting raylib
namespaces
|
| | |
|
| |
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
| |
eb_get_line_string always return valid string, however
eb_get_line_slice has a chance to return slice with NULL ptr.
|
| |
|
|
|
| |
Implement helper draw_text_slice which just allocate C-string on the
stack and pass it to the DrawText.
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
| |
This is important for current line_get_stirng implementation, which
allocates real vector when it is called with lazy loaded `li`.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
|
|
|
|
| |
implement eb_get_last and is_cur_col_last to get consistant
abstraction for unallocated line or appending line.
fix set_cur_forward to more straightforward way.
[minor]
refactor ensure_line to use single variable li.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
This was rely on NULL-initialization of physically allocated
vector. When I remove that feature, it immediatly segfalt since
logically v->data[index] is not allocated so its not initialized by
NULL yet.
[minor]
add assert on vec_get to avoid this kind of stupid mistake.
|
| |
|
|
|
| |
[minor]
add log cursor on draw loop.
|
| |
|
|
|
| |
fix: eb_set_cur_back to handle unallocated line correctly when called
on head of the line.
|
| |
|
|
|
|
|
|
|
|
| |
It was "inserting" the new line to the current eb->cur_row
index. Which should just set or push (when inserting to the end of the
buffer) to the eb->vec[eb->cur_row].
[minor]
add assertion on vec_set.
add debug lines on draw loop.
|
| |
|
|
|
|
|
| |
It was actually allocating line buf when insert empty line...
[minor]
refactor eb_init to indicates each field initialization well.
|
| |
|
|
|
|
|
|
|
|
|
| |
Before deleting curr, it does not freeing it!
[minor]
optimize vec_delete; if sizeof v is 0, do not call memmove.
refactor line_init to clearly indicates both value are initialized to
0.
optimize line_cat; if src is empty (['\0']), do not call
Vec_char_delete or something.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This is important because eb_backspace remove lines by the index
of vector. Although there is pro for lazy allocation for actual line
buffer, no-allocating line vector itself increase ambiguty too much.
Also this commit removes the feature that eb_get_line returns NULL
when its index is not correct, because this is ambiguouse with actual
line pointer is NULL on line vector and causes unfindable bug.
[minor]
add assert on line_split
|
| |
|
|
|
| |
[minor]
implement eb_get_cur_col and *_row
|
| |
|
|
|
|
|
|
|
| |
quite a nested function. to implement lazy allocation for line
buffer. is there a proper way to do it???
[minor]
fix warning msg on eb_insert which was incomplecation type on printf
add <stdio.h> on config.h DEBUG section
|
| |
|
|
| |
line_cat should be implemented; markd it TODO
|
| |
|
|
| |
It was deleting entire upper line when backspaced on first column.
|
| |
|
|
|
|
|
| |
makefile now handle each object and sources seperately to handle
header change gracefully.
and from now on, #DEBUG should declared inside of config.h
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
I move around most of because it did not update eb->cur_col correctly.
implement line_split which use vec_split for it
[minor]
implement eb_get_line and eb_line_num
refactor main routine to use them
add DEBUG symbol to makefile and remove lines.o for OBJS
move declaration struct line to line.c from line.h for enhanced OOP
|
| |
|
|
|
|
|
| |
fix eb_backspace to actually backspace char, not delete it
[minor]
fix line_insert to handle li->last correctly
|
| |
|
|
|
| |
Mark eb_newline as TODO because it is not able to insert newline on
middle or end of the line.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
| |
- Fixed incorrect `MemAlloc(sizeof(type *))` usage to properly allocate `sizeof(type)` for vector structs.
- Corrected `memmove` call in vector insert to account for type size and copy full range.
- Added `line_set_cursor()` to set line's cursor position before inserting new lines.
- Replaced `line_arr` with `line_vec` in editor buffer for clearer naming.
- Improved `DrawText` fallback behavior for NULL lines.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
- Rename vector type VEC -> Vec_char for clarity
- Update line.c to use renamed Vec_char API
- Add `line_insert` function for character insertion at arbitrary positions
- Define Vec_slinep as vector of line pointers in main.c
- Introduce `struct ed_buf` as an abstraction for a text buffer
- Implement `eb_insert`, `eb_free` and stub `eb_newline`, `eb_backspace`
- Update main loop to use `ed_buf` instead of standalone line/lines
- Fix vector insertion logic to support gaps and non-contiguous positions
- Change optimization level in makefile to -O0 for easier debugging
|
| |
|
|
| |
ed_buf (editor buf) define the context of the editor.
|
| | |
|
| |
|
|
| |
Refactor the codebase to isolate line-collection logic from the main.c driver
|