commit 279bfc2df6d884d127165bef41c99f59139aa6b7
parent d0b7725c29c752154eac0f92e68dab0a8d97ed6d
Author: rexim <reximkut@gmail.com>
Date: Thu, 29 Dec 2022 16:15:39 +0700
Line_ -> Line
Diffstat:
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/editor.c b/src/editor.c
@@ -12,7 +12,7 @@ void editor_backspace(Editor *e)
e->cursor = e->data.count;
}
if (e->cursor == 0) return;
-
+
memmove(
&e->data.items[e->cursor - 1],
&e->data.items[e->cursor],
@@ -84,7 +84,7 @@ size_t editor_cursor_row(const Editor *e)
{
assert(e->lines.count > 0);
for (size_t row = 0; row < e->lines.count; ++row) {
- Line_ line = e->lines.items[row];
+ Line line = e->lines.items[row];
if (line.begin <= e->cursor && e->cursor <= line.end) {
return row;
}
@@ -97,7 +97,7 @@ void editor_move_line_up(Editor *e)
size_t cursor_row = editor_cursor_row(e);
size_t cursor_col = e->cursor - e->lines.items[cursor_row].begin;
if (cursor_row > 0) {
- Line_ next_line = e->lines.items[cursor_row - 1];
+ Line next_line = e->lines.items[cursor_row - 1];
size_t next_line_size = next_line.end - next_line.begin;
if (cursor_col > next_line_size) cursor_col = next_line_size;
e->cursor = next_line.begin + cursor_col;
@@ -109,7 +109,7 @@ void editor_move_line_down(Editor *e)
size_t cursor_row = editor_cursor_row(e);
size_t cursor_col = e->cursor - e->lines.items[cursor_row].begin;
if (cursor_row < e->lines.count - 1) {
- Line_ next_line = e->lines.items[cursor_row + 1];
+ Line next_line = e->lines.items[cursor_row + 1];
size_t next_line_size = next_line.end - next_line.begin;
if (cursor_col > next_line_size) cursor_col = next_line_size;
e->cursor = next_line.begin + cursor_col;
@@ -148,7 +148,7 @@ void editor_recompute_lines(Editor *e)
{
e->lines.count = 0;
- Line_ line;
+ Line line;
line.begin = 0;
for (size_t i = 0; i < e->data.count; ++i) {
diff --git a/src/editor.h b/src/editor.h
@@ -6,7 +6,7 @@
typedef struct {
size_t begin;
size_t end;
-} Line_;
+} Line;
typedef struct {
char *items;
@@ -15,7 +15,7 @@ typedef struct {
} Data;
typedef struct {
- Line_ *items;
+ Line *items;
size_t count;
size_t capacity;
} Lines;
diff --git a/src/main.c b/src/main.c
@@ -95,7 +95,7 @@ void render_editor_into_fgb(SDL_Window *window, Free_Glyph_Buffer *fgb, Cursor_R
{
for (size_t row = 0; row < editor->lines.count; ++row) {
- Line_ line = editor->lines.items[row];
+ Line line = editor->lines.items[row];
const Vec2f begin = vec2f(0, -(float)row * FREE_GLYPH_FONT_SIZE);
Vec2f end = begin;
@@ -118,7 +118,7 @@ void render_editor_into_fgb(SDL_Window *window, Free_Glyph_Buffer *fgb, Cursor_R
Vec2f cursor_pos = vec2fs(0.0f);
{
size_t cursor_row = editor_cursor_row(editor);
- Line_ line = editor->lines.items[cursor_row];
+ Line line = editor->lines.items[cursor_row];
size_t cursor_col = editor->cursor - line.begin;
cursor_pos.y = -(float) cursor_row * FREE_GLYPH_FONT_SIZE;
cursor_pos.x = free_glyph_buffer_cursor_pos(