## STAGING
-* no magic right click
+* selecting lines no longer works if cursor is on first char
+* implement new version of tfetch
+* implement tide registrar
+* implement tctl command
* implement mouse warping on search, jump to line, and focus change
* gap buffer does not handle UTF-8 currently
* mouse selection handling when mouse moves outside region
void job_spawn(int fd, jobfn_t readfn, jobfn_t writefn, void* data);
void job_create(char** cmd, jobfn_t readfn, jobfn_t writefn, void* data);
void job_start(char** cmd, char* data, size_t ndata, View* dest);
+int job_run(char** cmd);
/* Configuration Data
*****************************************************************************/
ClrCount
};
-extern char *TagString, *Fonts[2];
+extern char *TagString, *Fonts[2], *FetchCmd[];
extern int Palette[ClrCount];
extern int WinWidth, WinHeight, ScrollWidth, Timeout, TabWidth, ScrollBy,
ClickTime, CopyIndent, TrimOnSave, ExpandTabs, DosLineFeed;
#include <utf.h>
#include <edit.h>
+char* FetchCmd[] = { "tfetch", NULL, NULL };
+
char* TagString = "Del Put Undo Redo | Font Tabs Eol | Find ";
+
char* Fonts[2] = {
"Verdana:size=11",
#ifdef __MACH__
job_finish(job);
}
-static int job_exec(char** cmd) {
+static int job_exec(char** cmd, int* p_pid) {
int pid, fds[2];
/* create the sockets */
if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0)
} else {
close(fds[1]);
}
+ if (p_pid) *p_pid = pid;
return fds[0];
}
}
void job_start(char** cmd, char* data, size_t ndata, View* dest) {
- int fd = job_exec(cmd);
+ int fd = job_exec(cmd, 0);
if (fd >= 0 && (data || dest)) {
struct PipeData* pipedata = NULL;
if (data) {
close(fd);
}
}
+
+int job_run(char** cmd) {
+ int pid = -1, status = 0;
+ job_exec(cmd, &pid);
+ do {
+ waitpid(pid, &status, WUNTRACED|WCONTINUED);
+ } while (!WIFEXITED(status) && !WIFSIGNALED(status));
+ return WEXITSTATUS(status);
+}
if (PRESSED(MouseLeft)) {
paste(NULL);
} else {
- SearchDir *= (win_keymodsset(ModShift) ? -1 : +1);
- free(SearchTerm);
- SearchTerm = view_fetch(win_view(id), row, col, risfile);
- view_findstr(win_view(id), SearchDir, SearchTerm);
+ FetchCmd[1] = view_fetch(win_view(id), row, col, risfile);
+ if (job_run(FetchCmd) != 0) {
+ SearchDir *= (win_keymodsset(ModShift) ? -1 : +1);
+ free(SearchTerm);
+ SearchTerm = view_fetch(win_view(id), row, col, risfile);
+ view_findstr(win_view(EDIT), SearchDir, SearchTerm);
+ } else {
+ free(FetchCmd[1]);
+ }
}
}
/* Sed command used to execute commands marked with ':' sigil */
char* SedCmd[] = { "sed", "-e", NULL, NULL };
-/* Try to fetch the text with tide-fetch */
-char* FetchCmd[] = { "tfetch", NULL, NULL };
-
#define CMD_TIDE "!tide"
#define CMD_PICKFILE "!pickfile ."
#define CMD_COMPLETE "<picktag print tags"