Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ DOCDIR = $(PREFIX)/share/doc/emsys

# Source files
OBJECTS = main.o wcwidth.o unicode.o buffer.o region.o undo.o transform.o \
find.o pipe.o tab.o register.o fileio.o terminal.o display.o \
keymap.o edit.o prompt.o util.o
find.o pipe.o register.o fileio.o terminal.o display.o \
keymap.o edit.o prompt.o util.o completion.o history.o

# Default target with git version detection
all:
@VERSION="`git describe --tags --always --dirty 2>/dev/null || echo $(VERSION)`"; \
make VERSION="$$VERSION" $(PROGNAME)
$(MAKE) VERSION="$$VERSION" $(PROGNAME)

# Link the executable
$(PROGNAME): $(OBJECTS)
Expand Down Expand Up @@ -73,35 +73,37 @@ check: test

# Sorry Dave
hal:
make clean
make CFLAGS="$(CFLAGS) -D_POSIX_C_SOURCE=200112L -Werror" $(PROGNAME)
make test
$(MAKE) format
$(MAKE) clean
for f in *.c; do clang-tidy $$f -- -I. ; done
$(MAKE) CFLAGS="$(CFLAGS) -D_POSIX_C_SOURCE=200112L -Werror" $(PROGNAME)
$(MAKE) test

# Development targets
debug:
make CFLAGS="$(CFLAGS) -g -O0" $(PROGNAME)
$(MAKE) CFLAGS="$(CFLAGS) -g -O0" $(PROGNAME)


format:
clang-format -i *.c *.h

# Platform-specific variants
android:
make CC=clang CFLAGS="$(CFLAGS) -fPIC -fPIE -DEMSYS_DISABLE_PIPE" LDFLAGS="-pie" $(PROGNAME)
$(MAKE) CC=clang CFLAGS="$(CFLAGS) -fPIC -fPIE -DEMSYS_DISABLE_PIPE" LDFLAGS="-pie" $(PROGNAME)


msys2:
make CFLAGS="$(CFLAGS) -D_GNU_SOURCE" $(PROGNAME)
$(MAKE) CFLAGS="$(CFLAGS) -D_GNU_SOURCE" $(PROGNAME)

minimal:
make CFLAGS="$(CFLAGS) -DEMSYS_DISABLE_PIPE -Os" $(PROGNAME)
$(MAKE) CFLAGS="$(CFLAGS) -DEMSYS_DISABLE_PIPE -Os" $(PROGNAME)

solaris:
VERSION="$(VERSION)" make CC=cc CFLAGS="-xc99 -D__EXTENSIONS__ -O2 -errtags=yes -erroff=E_ARG_INCOMPATIBLE_WITH_ARG_L" $(PROGNAME)
VERSION="$(VERSION)" $(MAKE) CC=cc CFLAGS="-xc99 -D__EXTENSIONS__ -O2 -errtags=yes -erroff=E_ARG_INCOMPATIBLE_WITH_ARG_L" $(PROGNAME)


darwin:
make CC=clang CFLAGS="$(CFLAGS) -D_DARWIN_C_SOURCE" $(PROGNAME)
$(MAKE) CC=clang CFLAGS="$(CFLAGS) -D_DARWIN_C_SOURCE" $(PROGNAME)



Expand Down
7 changes: 7 additions & 0 deletions buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,11 @@ struct editorBuffer *newBuffer(void) {
ret->special_buffer = 0;
ret->undo = newUndo();
ret->redo = NULL;
ret->completion_state.last_completed_text = NULL;
ret->completion_state.completion_start_pos = 0;
ret->completion_state.successive_tabs = 0;
ret->completion_state.last_completion_count = 0;
ret->completion_state.preserve_message = 0;
ret->next = NULL;
ret->truncate_lines = 0;
ret->rectangle_mode = 0;
Expand All @@ -340,7 +345,9 @@ struct editorBuffer *newBuffer(void) {
void destroyBuffer(struct editorBuffer *buf) {
clearUndosAndRedos(buf);
free(buf->filename);
free(buf->query);
free(buf->screen_line_start);
free(buf->completion_state.last_completed_text);
for (int i = 0; i < buf->numrows; i++) {
freeRow(&buf->row[i]);
}
Expand Down
Loading
Loading