|
@@ -30,12 +30,7 @@ static void line_grow(Line *line, size_t n)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-void line_append_text(Line *line, const char *text)
|
|
|
|
-{
|
|
|
|
- line_append_text_sized(line, text, strlen(text));
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-void line_append_text_sized(Line *line, const char *text, size_t text_size)
|
|
|
|
|
|
+void line_append_text(Line *line, const char *text, size_t text_size)
|
|
{
|
|
{
|
|
size_t col = line->size;
|
|
size_t col = line->size;
|
|
line_insert_text_sized_before(line, text, text_size, &col);
|
|
line_insert_text_sized_before(line, text, text_size, &col);
|
|
@@ -205,10 +200,10 @@ void editor_load_from_file(Editor *editor, FILE *file)
|
|
String_View chunk_line = {0};
|
|
String_View chunk_line = {0};
|
|
Line *line = &editor->lines[editor->size - 1];
|
|
Line *line = &editor->lines[editor->size - 1];
|
|
if (sv_try_chop_by_delim(&chunk_sv, '\n', &chunk_line)) {
|
|
if (sv_try_chop_by_delim(&chunk_sv, '\n', &chunk_line)) {
|
|
- line_append_text_sized(line, chunk_line.data, chunk_line.count);
|
|
|
|
|
|
+ line_append_text(line, chunk_line.data, chunk_line.count);
|
|
editor_insert_new_line(editor);
|
|
editor_insert_new_line(editor);
|
|
} else {
|
|
} else {
|
|
- line_append_text_sized(line, chunk_sv.data, chunk_sv.count);
|
|
|
|
|
|
+ line_append_text(line, chunk_sv.data, chunk_sv.count);
|
|
chunk_sv = SV_NULL;
|
|
chunk_sv = SV_NULL;
|
|
}
|
|
}
|
|
}
|
|
}
|