Archived
1
Fork 0
This repository has been archived on 2024-10-07. You can view files and clone it, but cannot push or open issues or pull requests.
kilo/include/buffer.h
Hadeed Ahmad fc5e50e4db Refactor a lot
Doesn't compile yet. Dreading the time when it does and there's an error
in the hundreds of lines I changed. For future: commit small changes
that can be compiled and tested atomically.
2023-09-08 21:55:36 +05:00

31 lines
687 B
C

#ifndef BUFFER_H
#define BUFFER_H
#include <stdbool.h>
#include <stddef.h>
#include "utils.h"
#include "erow.h"
struct buffer {
char *filename;
int cx, cy, rx;
int row_off, col_off;
struct erow **rows;
int n_rows;
bool modified;
};
struct buffer *buffer_create(void);
ERRCODE buffer_read_file(struct buffer *buffer, const char *filename);
ERRCODE buffer_write_file(struct buffer *buffer, size_t *bytes_written);
void buffer_insert_row(struct buffer *buffer, struct erow *erow, int at);
void buffer_delete_row(struct buffer *buffer, int at);
struct erow *buffer_get_crow(struct buffer *buffer);
void buffer_free(struct buffer *buffer);
#endif // BUFFER_H