#pragma once
#include "node.h"

void die(const char *s);
void get_terminal_size(int *rows, int *cols);
int display_width(const char *grapheme);
char *read_file(const char *filename);
Line split_graphemes(const char *input);
size_t byte_to_grapheme(Line *line, size_t b);
size_t grapheme_to_byte_col(Line *line, size_t col);
size_t grapheme_to_byte(Line *line);
void folds_account(size_t *row, BufferData *e);
Coords filter_visible_lines(BufferData *e, VirtLine ***out_virt,
                            Line ***out_lines, size_t *out_count);
int visible_to_physical(BufferData *e, int visible_row);
size_t clamp_to_visible(BufferData *e, int row, int dir);
bool line_is_hidden(BufferData *e, size_t idx);
int physical_to_visible(BufferData *e, int prow);
int visible_count(BufferData *e);
_Bool line_is_start(BufferData *e, size_t idx);
char *line_to_string(Line *line);
char *lines_to_string(BufferData *e);
uint32_t fnv1a_32(const char *data, size_t len);
int file_type(const char *filename);
