Modularize insertion/deletion
This commit is contained in:
@@ -115,5 +115,7 @@ void cursor_left(Editor *editor, uint32_t number);
|
||||
void cursor_right(Editor *editor, uint32_t number);
|
||||
void ensure_scroll(Editor *editor);
|
||||
void apply_edit(std::vector<Span> &spans, uint32_t x, int64_t y);
|
||||
void edit_erase(Editor *editor, uint32_t pos, uint32_t len);
|
||||
void edit_insert(Editor *editor, uint32_t pos, char *data, uint32_t len);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -100,7 +100,7 @@ char *read(Knot *root, uint32_t offset, uint32_t len);
|
||||
void split(Knot *node, uint32_t offset, Knot **left, Knot **right);
|
||||
|
||||
// Used to convert a byte offset to a line number that contains that byte
|
||||
uint32_t byte_to_line(Knot *node, uint32_t offset);
|
||||
uint32_t byte_to_line(Knot *node, uint32_t offset, uint32_t *out_col);
|
||||
|
||||
// Used to convert a line number to a byte offset (start of the line)
|
||||
// also sets out_len to the length of the line
|
||||
|
||||
@@ -36,7 +36,7 @@ struct Coord {
|
||||
uint32_t col;
|
||||
};
|
||||
|
||||
uint32_t grapheme_strlen(const char *s);
|
||||
uint32_t visual_width(const char *s);
|
||||
uint32_t get_visual_col_from_bytes(const char *line, uint32_t byte_limit);
|
||||
uint32_t get_bytes_from_visual_col(const char *line,
|
||||
uint32_t target_visual_col);
|
||||
|
||||
Reference in New Issue
Block a user