aboutsummaryrefslogtreecommitdiff
path: root/main.c
Commit message (Collapse)AuthorAgeFilesLines
* Add newlineHEADmasterdilluti0n11 days1-1/+1
|
* Make two chaotic windows to onedilluti0n2026-07-171-4/+1
|
* Print log if file is not givendilluti0n2026-07-171-3/+5
| | | | Long time no see, I thought there was some problem at first.
* Make scroll actaully scrolldilluti0n2026-04-201-1/+1
| | | | | | | | | | | | | | | | | | 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.
* feat: enable fraction format of each geometry metadatas on viewdilluti0n2025-06-011-5/+7
|
* fix: main.c to update redr context when window is resizeddilluti0n2025-06-011-2/+7
|
* refactor: introduce view.c; ui drawing abstraction layerdilluti0n2025-06-011-4/+14
| | | | | | | | | | | | | | | 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.
* refactor: abstract input/rendering modules from main routinedilluti0n2025-05-281-146/+11
| | | | | | 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.
* refactor: replace #ifdef DEBUG printf to log_printfdilluti0n2025-05-141-8/+13
| | | | - fix log_printf to not automatically insert newline
* refactor: unify log level and stream setup via log_initdilluti0n2025-05-141-2/+2
| | | | | | | | - 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: integrate raylib logs to RED log levelsdilluti0n2025-05-131-6/+33
| | | | | - refactor enums in LOG_* to RED_LOG_* since its conflicting raylib namespaces
* feat: introduce log.c; log handling moduledilluti0n2025-05-101-1/+1
|
* fix: Memory Leak in eb_delete_linedilluti0n2025-05-101-1/+0
| | | | | | 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.
* fix: possable buffer overflow when sl.len >= BUFSIZE on draw routinedilluti0n2025-05-011-2/+4
|
* fix: NULL check sl.ptr on main routine.dilluti0n2025-04-291-2/+2
| | | | | eb_get_line_string always return valid string, however eb_get_line_slice has a chance to return slice with NULL ptr.
* refactor: main draw routine to use eb_get_line_slice instead string.dilluti0n2025-04-291-6/+21
| | | | | Implement helper draw_text_slice which just allocate C-string on the stack and pass it to the DrawText.
* refactor: decouple line.h from main.cdilluti0n2025-04-291-4/+2
| | | | | | | | 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.
* perf: update draw loop to access actrually visable line only.dilluti0n2025-04-291-4/+9
| | | | | This is important for current line_get_stirng implementation, which allocates real vector when it is called with lazy loaded `li`.
* feat: add right control C-sdilluti0n2025-04-291-2/+3
|
* remove uncontroled logdilluti0n2025-04-291-1/+0
|
* add keyboard shortcut C-s to save filedilluti0n2025-04-281-13/+13
|
* add: basic i/o structure on main rendering loopdilluti0n2025-04-281-0/+13
| | | | | 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.
* fix: eb_set_cur_next does not recovering cached cursor from line.dilluti0n2025-04-281-3/+2
| | | | | [minor] add argc and argv to main routine.
* refactor: move ed_* modules from main.c to editor.cdilluti0n2025-04-281-175/+4
|
* change: eb_get_line to return NULL if index is 'appending' line.dilluti0n2025-04-281-23/+30
| | | | | | | | | 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.
* fix: draw routine cannot draw last line's cursordilluti0n2025-04-281-1/+1
|
* refactor: introduce helper function ensure_line for eb_insertdilluti0n2025-04-271-12/+16
|
* fix: inserting on newline cause segmentatnion faultdilluti0n2025-04-271-1/+2
| | | | | | | | | | 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.
* implement: eb_set_cur_nextdilluti0n2025-04-271-1/+7
| | | | | [minor] add log cursor on draw loop.
* implement: eb_set_cur_forwarddilluti0n2025-04-271-6/+33
| | | | | fix: eb_set_cur_back to handle unallocated line correctly when called on head of the line.
* fix: eb_insert to grow line pointer array properlydilluti0n2025-04-271-4/+12
| | | | | | | | | | 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.
* fix: eb_newline to properly lazy allocate newlinedilluti0n2025-04-271-2/+5
| | | | | | | It was actually allocating line buf when insert empty line... [minor] refactor eb_init to indicates each field initialization well.
* fix: eb_backspace possable memory leakdilluti0n2025-04-271-18/+15
| | | | | | | | | | | 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.
* implement: eb_set_cur_back and eb_set_cur_prevdilluti0n2025-04-271-2/+22
|
* modify: eb_newline to actually increase the vec when newlinedilluti0n2025-04-271-7/+6
| | | | | | | | | | | | | 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
* add: draw cursor on rendering loopdilluti0n2025-04-271-1/+23
| | | | | [minor] implement eb_get_cur_col and *_row
* implement: eb_backspacedilluti0n2025-04-271-3/+23
| | | | | | | | | 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
* implement: eb_backspace; line_cat still TODOdilluti0n2025-04-271-6/+5
| | | | line_cat should be implemented; markd it TODO
* to-fix: add TODO for ed_backspace since it is not well implementeddilluti0n2025-04-271-2/+3
| | | | It was deleting entire upper line when backspaced on first column.
* refactor: move debugs to config.h and handle build gracefullydilluti0n2025-04-271-6/+2
| | | | | | | makefile now handle each object and sources seperately to handle header change gracefully. and from now on, #DEBUG should declared inside of config.h
* implement: eb_newlinedilluti0n2025-04-271-12/+26
| | | | | | | | | | | | | 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
* implement: line_deletedilluti0n2025-04-271-3/+4
| | | | | | | fix eb_backspace to actually backspace char, not delete it [minor] fix line_insert to handle li->last correctly
* change: vec_grow_size able to reduce the size toodilluti0n2025-04-241-1/+2
| | | | | Mark eb_newline as TODO because it is not able to insert newline on middle or end of the line.
* fix: eb_insert to move the cursor after insertiondilluti0n2025-04-241-1/+1
|
* change: vector.h now alloc/free its own handledilluti0n2025-04-241-3/+1
|
* implement: eb_backspacedilluti0n2025-04-241-9/+22
|
* fix: vector memory allocation and insert logic; cleanup eb handlingdilluti0n2025-04-211-16/+30
| | | | | | | | - 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.
* refactor: line handling and implement basic editor buffer abstractiondilluti0n2025-04-211-20/+32
| | | | | | | | | | | | - 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
* implement: eb_initdilluti0n2025-04-181-0/+37
| | | | ed_buf (editor buf) define the context of the editor.
* tabify, gitignore, add -Wextra to CFLAGSdilluti0n2025-04-181-12/+12
|