This commit is contained in:
2025-12-18 17:06:47 +00:00
parent f764c78c6b
commit f347f50dbe
6 changed files with 682 additions and 652 deletions

View File

@@ -137,13 +137,12 @@ inline const Fold *fold_for_line(const std::vector<Fold> &folds,
}
inline Fold *fold_for_line(std::vector<Fold> &folds, uint32_t line) {
const auto *fold = fold_for_line(static_cast<const std::vector<Fold> &>(folds),
line);
const auto *fold =
fold_for_line(static_cast<const std::vector<Fold> &>(folds), line);
return const_cast<Fold *>(fold);
}
inline bool line_is_fold_start(const std::vector<Fold> &folds,
uint32_t line) {
inline bool line_is_fold_start(const std::vector<Fold> &folds, uint32_t line) {
const Fold *fold = fold_for_line(folds, line);
return fold && fold->start == line;
}
@@ -203,5 +202,11 @@ void word_boundaries(Editor *editor, Coord coord, uint32_t *prev_col,
uint32_t *next_clusters);
void word_boundaries_exclusive(Editor *editor, Coord coord, uint32_t *prev_col,
uint32_t *next_col);
std::vector<Fold>::iterator find_fold_iter(Editor *editor, uint32_t line);
bool add_fold(Editor *editor, uint32_t start, uint32_t end);
bool remove_fold(Editor *editor, uint32_t line);
void apply_line_insertion(Editor *editor, uint32_t line, uint32_t rows);
void apply_line_deletion(Editor *editor, uint32_t removal_start,
uint32_t removal_end);
#endif

View File

@@ -117,6 +117,12 @@ LineIterator *begin_l_iter(Knot *root, uint32_t start_line);
// freed by the caller
char *next_line(LineIterator *it, uint32_t *out_len);
// Returns the previous line as a null terminated string
// `it` is the iterator returned from begin_l_iter
// it can be used to iterate backwards
// and can be used along with next_line
// doing prev_line then next_line or vice versa will return the same line
// `out_len` is set to the length of the returned string
char *prev_line(LineIterator *it, uint32_t *out_len);
// Used to start an iterator over leaf data