]> git.mdlowis.com Git - projs/tide.git/commitdiff
general cleanup
authorMichael D. Lowis <mike@mdlowis.com>
Thu, 24 Nov 2016 17:34:53 +0000 (12:34 -0500)
committerMichael D. Lowis <mike@mdlowis.com>
Thu, 24 Nov 2016 17:34:53 +0000 (12:34 -0500)
libedit/utils.c
libx/x11.c
xedit.c

index 4aae69f9c611450f769ba9b57766fb44d6a6fe9e..154b34b995b42bf68b7029ed02263fd3c497358d 100644 (file)
 #include <time.h>
 #include <sys/time.h>
 
-#ifdef __MACH__
-#define CLOCK_MONOTONIC 0
-// clock_gettime is not implemented on OSX (supposedly added on macOS)
-int clock_gettime(int id, struct timespec* t) {
-    (void)id;
-    struct timeval now;
-    int rv = gettimeofday(&now, NULL);
-    if (rv) return rv;
-    t->tv_sec  = now.tv_sec;
-    t->tv_nsec = now.tv_usec * 1000;
-    return 0;
-}
-#endif
-
 uint32_t getmillis(void) {
     struct timespec time;
     clock_gettime(CLOCK_MONOTONIC, &time);
index fd1e167a433ac021cfa7eb8e5c51428949705093..ec77fc0a11867fd6411a7ce136399e1ebf9d723a 100644 (file)
@@ -67,7 +67,7 @@ void x11_init(XConfig* cfg) {
     /* open the X display and get basic attributes */
     Config = cfg;
     if (!(X.display = XOpenDisplay(0)))
-        assert(false);
+        die("could not open display");
     X.root = DefaultRootWindow(X.display);
     XWindowAttributes wa;
     XGetWindowAttributes(X.display, X.root, &wa);
diff --git a/xedit.c b/xedit.c
index 236969ba74931ee862aac832e9bdbea4a5fabcd0..8be13695d42ca114e20e0fa9f4e4764e4e8ee6a9 100644 (file)
--- a/xedit.c
+++ b/xedit.c
@@ -420,7 +420,6 @@ static void search(void) {
     char* str = view_getstr(currview(), NULL);
     view_findstr(getview(EDIT), str);
     free(str);
-    Focused = EDIT;
 }
 
 static void find(char* arg) {
@@ -455,9 +454,9 @@ static void mouse_middle(enum RegionId id, size_t count, size_t row, size_t col)
         } else {
             /* if it isn't then check the tags buffer selection */
             arg = view_getstr(getview(TAGS), NULL);
+            /* if we still haven't found it, check the edit buffer selection */
+            if (!arg) arg = view_getstr(getview(EDIT), NULL);
         }
-        /* if we still haven't found it, check the edit buffer selection */
-        if (!arg) arg = view_getstr(getview(EDIT), NULL);
         tag_handler(tag, arg);
         free(str);
         free(arg);