editor/page.h
2021-12-21 16:53:29 +10:00

30 lines
763 B
C

#ifndef PAGE_H
#define PAGE_H
/* PAGE struct definition and related functions */
#include <curses.h> // might have to move this
#include "line.h"
#define PAGE_SIZE 500 /* Default number of lines */
#define WIN_SIZE (LINES - 2) /* Size of window, making room for bottom prompt */
#define NAME_LIMIT 256 /* Max size of a unix filename + 1 */
typedef struct
{
char filename[NAME_LIMIT];
LINE *text; // lines of text
int numlines;
int size; // size of array
int x, y;
int saved;
} PAGE;
void init_page(PAGE *p, char *filename, int size);
void dest_page(PAGE *p);
void insert_line(PAGE *p, int index);
void remove_line(PAGE *p, int index);
void expand_page(PAGE *p);
void print_page(WINDOW *win, WINDOW *lnos, const PAGE *p, int start, int end);
#endif