summaryrefslogtreecommitdiff
path: root/line.h
diff options
context:
space:
mode:
authorcflip <cflip@cflip.net>2023-01-17 10:39:21 -0700
committercflip <cflip@cflip.net>2023-01-17 10:39:21 -0700
commit1a416a917d74d956469e6e80cf4bb519e9474c91 (patch)
tree6e61b15d9cece1af0a64d3a9cd2a5d5dd73815b7 /line.h
parent8be3915417bcafdbf2a8752980db96e06df096aa (diff)
Rename 'rows' to 'lines' everywhere
For whatever reason lines were called rows in the code, so this refactor changes that name everywhere. The name 'row' is still used in some places to refer to the unit of height in the screen.
Diffstat (limited to 'line.h')
-rw-r--r--line.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/line.h b/line.h
new file mode 100644
index 0000000..e74b17e
--- /dev/null
+++ b/line.h
@@ -0,0 +1,33 @@
+#ifndef _LINE_H
+#define _LINE_H
+
+#include <stddef.h>
+
+#define TAB_WIDTH 4
+
+typedef struct {
+ int index;
+ int size;
+ char* chars;
+ int render_size;
+ char* render;
+ unsigned char* highlight;
+ int highlight_open_comment;
+} line_t;
+
+struct editor_state;
+
+int row_x_to_display_x(line_t*, int x);
+int row_display_x_to_x(line_t*, int display_x);
+
+void editor_update_line(struct editor_state*, line_t*);
+void editor_insert_line(struct editor_state*, int at, char *string, size_t length);
+void editor_delete_line(struct editor_state*, int at);
+
+void line_insert_char(struct editor_state*, line_t*, int at, int c);
+void line_append_string(struct editor_state*, line_t*, char* string, size_t length);
+void line_delete_char(struct editor_state*, line_t*, int at);
+
+void free_line(line_t*);
+
+#endif