浏览代码

Line_ -> Line

rexim 2 年之前
父节点
当前提交
279bfc2df6
共有 3 个文件被更改,包括 9 次插入9 次删除
  1. 5 5
      src/editor.c
  2. 2 2
      src/editor.h
  3. 2 2
      src/main.c

+ 5 - 5
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) {

+ 2 - 2
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;

+ 2 - 2
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(