]> git.mdlowis.com Git - projs/tide.git/commitdiff
Combined libx and libedit
authorMichael D. Lowis <mike.lowis@gentex.com>
Thu, 5 Jan 2017 17:46:50 +0000 (12:46 -0500)
committerMichael D. Lowis <mike.lowis@gentex.com>
Thu, 5 Jan 2017 17:46:50 +0000 (12:46 -0500)
12 files changed:
.gitignore
Makefile
TODO.md
fetchtag.c [deleted file]
lib/buf.c [moved from libedit/buf.c with 100% similarity]
lib/exec.c [moved from libedit/exec.c with 100% similarity]
lib/filetype.c [moved from libedit/filetype.c with 100% similarity]
lib/utf8.c [moved from libedit/utf8.c with 100% similarity]
lib/utils.c [moved from libedit/utils.c with 100% similarity]
lib/view.c [moved from libedit/view.c with 100% similarity]
lib/x11.c [moved from libx/x11.c with 100% similarity]
tools/coverage.sh [moved from coverage.sh with 100% similarity]

index 51995e0a3cf304c56e846d559eef79129158c80d..2c0e260eae93f2c78a6269e8c2182f0278b6ab7e 100644 (file)
@@ -40,3 +40,4 @@ tags
 *.gcov
 xedit
 xpick
+DELETEME
index 277e5e9c421e2e6d72d5e95036cfd4523ad812ed..27359b4fb28c06c9c575f314d3c4608764b78c6c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,13 @@
 INCS = -Iinc/
 
-LIBEDIT_OBJS =         \
-       libedit/buf.o      \
-       libedit/filetype.o \
-       libedit/utf8.o     \
-       libedit/utils.o    \
-       libedit/exec.o     \
-       libedit/view.o
-
-LIBX_OBJS = \
-       libx/x11.o
+LIBEDIT_OBJS =     \
+       lib/buf.o      \
+       lib/filetype.o \
+       lib/utf8.o     \
+       lib/utils.o    \
+       lib/exec.o     \
+       lib/view.o     \
+       lib/x11.o
 
 TEST_OBJS =      \
        unittests.o  \
@@ -47,16 +45,13 @@ uninstall:
 test: unittests
        ./unittests
 
-xedit: xedit.o libx.a libedit.a
+xedit: xedit.o libedit.a
        $(LD) -o $@ $^ $(LDFLAGS)
 
-xpick: xpick.o libx.a libedit.a
+xpick: xpick.o libedit.a
        $(LD) -o $@ $^ $(LDFLAGS)
 
 libedit.a: $(LIBEDIT_OBJS)
        $(AR) $(ARFLAGS) $@ $^
 
-libx.a: $(LIBX_OBJS)
-       $(AR) $(ARFLAGS) $@ $^
-
 unittests: $(TEST_OBJS) libedit.a
diff --git a/TODO.md b/TODO.md
index ee8d344d2e2c984705c8aeb70da660884048a3df..2b88dec97a71cbc31dd53d39e07d94ba517b4a37 100644 (file)
--- a/TODO.md
+++ b/TODO.md
@@ -2,6 +2,7 @@
 
 Up Next:
 
+* Undo/Redo tags should apply to  the edit buffer, ctrl+z + ctrl+y to the current buffer
 * Tag line count should account for wrapped lines
 * block selection should handle brace-balancing
 * context sensitive selection of words, commands, line numbers, or filenames.
diff --git a/fetchtag.c b/fetchtag.c
deleted file mode 100644 (file)
index 8b0105a..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-#include <stdc.h>
-#include <utf.h>
-#include <edit.h>
-
-typedef struct {
-    char* file;
-    char* cmd;
-} Choice;
-
-void add_choice(uint8_t* buf, size_t n) {
-    char* str = malloc(n);
-    memcpy(str, buf, n);
-    str[n] = '\0';
-    /**/
-    char* tag  = strtok(str, "\t");
-    char* file = strtok(NULL, "\t");
-    char* cmd  = file + strlen(file) + 1;
-    char* end  = strrchr(cmd, ';');
-    if (end) *end = '\0';
-
-    puts(tag);
-    puts(file);
-    puts(cmd);
-}
-
-void fetchtags(char* tagfile, char* tag) {
-    size_t mlen = strlen(tag);
-    FMap file = fmap(tagfile);
-    for (size_t n, i = 0; i < file.len;) {
-        if (file.buf[i] > *tag) {
-            break;
-        } if ((file.buf[i + mlen] == '\t') &&
-              (0 == strncmp(((char*)file.buf+i), tag, mlen))) {
-            for (n = 0; file.buf[i + n++] != '\n';);
-            add_choice(file.buf + i, n-1);
-            i += n;
-        } else {
-            while (file.buf[i++] != '\n');
-        }
-    }
-}
-
-int main(int argc, char** argv) {
-    /* usage message */
-    if (argc != 3) {
-        printf("Usage: %s <tagfile> <tag>\n", argv[0]);
-        exit(1);
-    }
-    /* scan the file */
-    fetchtags(argv[1], argv[2]);
-    return 0;
-}
similarity index 100%
rename from libedit/buf.c
rename to lib/buf.c
similarity index 100%
rename from libedit/exec.c
rename to lib/exec.c
similarity index 100%
rename from libedit/filetype.c
rename to lib/filetype.c
similarity index 100%
rename from libedit/utf8.c
rename to lib/utf8.c
similarity index 100%
rename from libedit/utils.c
rename to lib/utils.c
similarity index 100%
rename from libedit/view.c
rename to lib/view.c
similarity index 100%
rename from libx/x11.c
rename to lib/x11.c
similarity index 100%
rename from coverage.sh
rename to tools/coverage.sh