editor/line.h
2015-08-28 16:22:21 -07:00

25 lines
571 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 tabs; // keeps track of tabs so we can offset
int size; // size of array, not string
} 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