#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);
/* 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);
char* str = view_getstr(currview(), NULL);
view_findstr(getview(EDIT), str);
free(str);
- Focused = EDIT;
}
static void find(char* arg) {
} 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);