| Commit message (Collapse) | Author | Age | Files | Lines |
| ... | |
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
| |
"123456\0" -> last = 6
"789\0" -> last = 3
"123456789\0" -> last = 9 (6 + 3), not 8 (6 + (3 - 1))
|
| |
|
|
| |
multiply sizeof (type)
|
| |
|
|
| |
name vec_grow_size has chance to thought growing +dx size for vector.
|
| |
|
|
|
| |
[minor]
add documentation on line->vec
|
| |
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
| |
[minor]
remove 'raylin.h' on makefile
fix vector.h to able to compile... (just a minor issues)
|
| |
|
|
| |
OMG...
|
| |
|
|
| |
It would be clever decision to seperate cat last and insert middle.
|
| |
|
|
| |
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
|
| |
|
|
| |
they are no longer used and this is handled by eb_* methods.
|
| |
|
|
|
| |
[minor]
refactor argument i to index for enhance readability
|
| |
|
|
|
|
|
| |
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.
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
minor: tide vector.h macros with proper indents
|
| |
|
|
|
|
|
|
| |
- 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.
|
| | |
|
| | |
|
| |
|
|
| |
vec.c and vec.h deprecated by vector.h
|
| |
|
|
| |
Since project is not very large, this approach might increase simplicity.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
| | |
|
| | |
|
| |
|
|
| |
Refactor the codebase to isolate line-collection logic from the main.c driver
|
| |
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
| |
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
| | |
|
| |
|
|
|
|
| |
- 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
|
| |
|
|
|
|
|
|
| |
- 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
|
| |
|
|
| |
Should be improved
|
| | |
|
|
|
Dependancy: raylib-5.5_linux_amd64[1]
[1] https://github.com/raysan5/raylib/releases/tag/5.5
|