From 91195d34e1f71246cadc41705004d66ab647087e Mon Sep 17 00:00:00 2001 From: cflip Date: Sun, 8 Jan 2023 14:15:01 -0700 Subject: Initial import of existing source code This is based off of snaptoken's "Build Your Own Text Editor" tutorial at https://viewsourcecode.org/snaptoken/kilo/. --- row.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 row.h (limited to 'row.h') diff --git a/row.h b/row.h new file mode 100644 index 0000000..f3c9708 --- /dev/null +++ b/row.h @@ -0,0 +1,27 @@ +#pragma once + +#include + +#include "editor.h" + +#define TAB_WIDTH 4 + +struct editor_row { + int index; + int size; + char* chars; + int render_size; + char* render; + unsigned char* highlight; + int highlight_open_comment; +}; + +int row_x_to_display_x(struct editor_row* row, int x); +int row_display_x_to_x(struct editor_row* row, int display_x); +void update_row(struct editor_state* editor, struct editor_row* row); +void insert_row(struct editor_state* editor, int at, char* string, size_t length); +void free_row(struct editor_row* row); +void delete_row(struct editor_state* editor, int at); +void row_insert_char(struct editor_state* editor, struct editor_row* row, int at, int c); +void row_append_string(struct editor_state* editor, struct editor_row* row, char* string, size_t length); +void row_delete_char(struct editor_state* editor, struct editor_row* row, int at); -- cgit v1.2.3