refactor to move src and include
This commit is contained in:
parent
23f1a2ab8a
commit
2e662a95c1
7 changed files with 16 additions and 2 deletions
6
Makefile
6
Makefile
|
@ -6,14 +6,16 @@ VERSION = 1.0
|
|||
TARGET = vip
|
||||
PREFIX ?= /usr/local
|
||||
BINDIR = $(PREFIX)/bin
|
||||
MANDIR = $(PREFIX)/share/man/man1
|
||||
|
||||
# Flags
|
||||
CFLAGS = -O3 -march=native -mtune=native -pipe -s -flto -std=c99 -pedantic -Wall -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600
|
||||
|
||||
SRC = vip.c term.c bar.c
|
||||
SRC = src/*.c
|
||||
INCLUDE = include
|
||||
|
||||
$(TARGET): $(SRC)
|
||||
$(CC) $(SRC) -o $@ $(CFLAGS)
|
||||
$(CC) $(SRC) -o $@ $(CFLAGS) -I$(INCLUDE)
|
||||
|
||||
dist:
|
||||
mkdir -p $(TARGET)-$(VERSION)
|
||||
|
|
|
@ -139,6 +139,18 @@ void append_row(char *s, size_t len)
|
|||
vip.rows++;
|
||||
}
|
||||
|
||||
void row_insert_char(row *row, int at, int c)
|
||||
{
|
||||
if (at < 0 || at > row->size) {
|
||||
at = row->size;
|
||||
}
|
||||
row->chars = realloc(row->chars, row->size + 2);
|
||||
memmove(&row->chars[at + 1], &row->chars[at], row->size - at + 1);
|
||||
row->size++;
|
||||
row->chars[at] = c;
|
||||
update_row(row);
|
||||
}
|
||||
|
||||
void open_editor(char *filename)
|
||||
{
|
||||
free(vip.filename);
|
Loading…
Reference in a new issue