summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* modify: eb_newline to actually increase the vec when newlinedilluti0n2025-04-272-7/+10
| | | | | | | | | | | | | 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
* fix: line_cat handle src->last correctlydilluti0n2025-04-271-1/+1
| | | | | | | "123456\0" -> last = 6 "789\0" -> last = 3 "123456789\0" -> last = 9 (6 + 3), not 8 (6 + (3 - 1))
* fix: vec_cat memcpy sizedilluti0n2025-04-271-1/+2
| | | | multiply sizeof (type)
* refactor: rename vec_grow_size to *_grow_to_size to ambigutydilluti0n2025-04-271-5/+5
| | | | name vec_grow_size has chance to thought growing +dx size for vector.
* add: ASSERT on line_catdilluti0n2025-04-271-2/+4
| | | | | [minor] add documentation on line->vec
* implement: eb_backspacedilluti0n2025-04-272-3/+24
| | | | | | | | | 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: line_catdilluti0n2025-04-273-6/+19
| | | | | | [minor] remove 'raylin.h' on makefile fix vector.h to able to compile... (just a minor issues)
* fix: line_append were not updating li->last!!!!!!dilluti0n2025-04-271-0/+1
| | | | OMG...
* implement: vec_insert_vector and vec_catdilluti0n2025-04-271-0/+18
| | | | It would be clever decision to seperate cat last and insert middle.
* implement: eb_backspace; line_cat still TODOdilluti0n2025-04-273-6/+10
| | | | 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-276-15/+11
| | | | | | | 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-274-22/+62
| | | | | | | | | | | | | 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
* remove: deprecated lines.c and lines.hdilluti0n2025-04-272-38/+0
| | | | they are no longer used and this is handled by eb_* methods.
* implement: vec_splitdilluti0n2025-04-271-21/+28
| | | | | [minor] refactor argument i to index for enhance readability
* implement: line_deletedilluti0n2025-04-273-4/+16
| | | | | | | 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-242-5/+6
| | | | | 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-243-11/+11
|
* implement: eb_backspacedilluti0n2025-04-244-11/+31
|
* implement: vec_deletedilluti0n2025-04-241-58/+74
| | | | minor: tide vector.h macros with proper indents
* fix: vector memory allocation and insert logic; cleanup eb handlingdilluti0n2025-04-215-22/+51
| | | | | | | | - 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-215-39/+65
| | | | | | | | | | | | - 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: vec_insertdilluti0n2025-04-201-1/+18
|
* implement: eb_initdilluti0n2025-04-181-0/+37
| | | | ed_buf (editor buf) define the context of the editor.
* implement: unit test for vector::popdilluti0n2025-04-181-1/+24
|
* implement: unit test for vector::pushdilluti0n2025-04-181-4/+22
|
* remove: legacy vec.c and vec.hdilluti0n2025-04-182-78/+0
| | | | vec.c and vec.h deprecated by vector.h
* refactor: handle all unit tests in one sourcesdilluti0n2025-04-182-5/+6
| | | | Since project is not very large, this approach might increase simplicity.
* implement unit test for vector::init_and_free, vector::growdilluti0n2025-04-182-1/+48
|
* implement: Unit test for line_appenddilluti0n2025-04-185-7/+23
|
* tabify, gitignoredilluti0n2025-04-185-45/+47
|
* test: add initial Criterion unit-test scaffolding for `line` moduledilluti0n2025-04-183-2/+28
| | | | | | | | | | | | | * Introduce `test/test_line.c` with a basic append test validating `line_append()` updates `last` correctly. * Extend makefile - add `unittest` target that links against Criterion and existing objects - add `make test` phony for one-shot execution - ensure `clean` removes the test binary. * Update .gitignore to exclude the generated `unittest` executable. This sets up a reproducible test harness so we can grow TDD coverage as the editor evolves.
* tabify, gitignore, add -Wextra to CFLAGSdilluti0n2025-04-183-14/+15
|
* Add TODOdilluti0n2025-04-181-0/+27
|
* refactor: Split lines management into its own moduledilluti0n2025-04-184-38/+42
| | | | Refactor the codebase to isolate line-collection logic from the main.c driver
* Add multi-line support using vector of line pointersdilluti0n2025-04-181-18/+62
| | | | | | | | | | | | * main.c: - Introduce VEC_LINE (vector of struct line *) using DEFINE_VECTOR macro - Create `struct lines` to hold current line buffer and all past lines - Implement `lines_init`, `lines_append_last`, `lines_get_last_line`, `lines_free` - Modify main loop: - On KEY_ENTER, current line is stored and a new line is allocated - On BACKSPACE, deletion is done in current line - All stored lines and the current line are drawn line-by-line with vertical spacing - Replace previous single-line logic (`lineh`) with full multi-line editor buffer
* Introduce vector template and migrate line moduledilluti0n2025-04-184-13/+58
| | | | | | | | | | | | * vector.h: Add DEFINE_VECTOR macro for a header-only generic vector template - Implements common operations: init, push, pop, set, get, len, grow * line.[ch]: - Replace fixed char-only vec with VEC (DEFINE_VECTOR(char)) instance - Refactor memory allocation and method calls to use VEC_* macros * makefile: - Remove vec.o from OBJS (vec module is no longer used) * vec.[ch] is now obsolete; new vector types (e.g., line *) can be defined easily using a single DEFINE_VECTOR invocation
* tabifydilluti0n2025-04-182-12/+8
|
* feat: Add vec_pop function to vec moduledilluti0n2025-04-182-1/+11
| | | | | | - Added `vec_pop` to remove the last character from the vector - Ensures no-op if the vector is already empty - Updated vec.h to declare the new function
* refactor: Extract line handling logic into separate line moduledilluti0n2025-04-184-43/+63
| | | | | | | | - Moved line-related functions (init, append, clear, delete, free) out of main.c - Created new files: line.c and line.h to encapsulate `struct line` and its operations - Updated main.c to use the new line module - Simplified main.c by removing inline struct and function definitions - Adjusted makefile to compile line.o
* Implement line apidilluti0n2025-04-183-35/+96
| | | | Should be improved
* Implement vector moduledilluti0n2025-04-184-2/+45
|
* Implement simple real time interactive text renderingdilluti0n2025-04-183-0/+100
Dependancy: raylib-5.5_linux_amd64[1] [1] https://github.com/raysan5/raylib/releases/tag/5.5