editor/line.h
2021-12-21 21:15:08 +10:00

25 lines
542 B
C

#ifndef LINE_H
#define LINE_H
/* LINE struct and functions */
#include <string.h>
#include <stdlib.h>
#define LINE_SIZE 128 /* Max characters in a line. Expandable */
#define TAB_WIDTH 4
typedef struct
{
char *line;
int size; // size of array, not string
int lines_in_screen;
} LINE;
void init_line(LINE *s);
void insert_char(LINE *s, char c, int index); // inserts char to string
void remove_char(LINE *s, int index);
void expand(LINE *s); // doubles the size of the line
void add_char(LINE *s, char c); // add to end of line
#endif