* move by words is inconsistent. Example:
var infoId = 'readerinfo'+reader.id;
* Add a way to CD using a builtin (buffers will track original dir)
-* selection of 1 and arrow keys moves wrong direction
+* selection of size 1 and arrow keys moves wrong direction
* cd to root in xcpd
* Ctrl+; Shortcut to warp cursor to middle of current screen.
* shortcut to jump to previous edit
* Shift+Insert should insert primary selection
* Find shortcut should select previous word if current char is newline
* diagnostic messages can stack up if deselected and not resolved
+* mouse click and hold on scroll bar should continually scroll
# Auxillary Programs
# Linker Setup
LD = $(CC)
-LDFLAGS = $(LIBS) -lX11 -lXft -lfontconfig
+LDFLAGS = $(LIBS) -lX11 -lXft -lfontconfig -lutil
# Archive Setup
AR = ar
char* view_getctx(View* view);
void view_selctx(View* view);
void view_scroll(View* view, int move);
+void view_csrsummon(View* view);
void view_scrollpage(View* view, int move);
void view_setln(View* view, size_t line);
void view_indent(View* view, int dir);
view_byrune(win_view(FOCUSED), RIGHT, extsel);
}
+static void cursor_warp(void) {
+ view_csrsummon(win_view(FOCUSED));
+}
+
static void page_up(void) {
view_scrollpage(win_view(FOCUSED), UP);
}
va_list args;
char* curr = dest;
va_start(args, dest);
- for (char* s; (s = va_arg(args, char*));)
- while (*s) *(curr++) = *(s++);
+ for (char* s = NULL; (s = va_arg(args, char*));)
+ while (s && *s) *(curr++) = *(s++);
va_end(args);
*curr = '\0';
return dest;
}
}
-void view_scrollpage(View* view, int move) {
+void view_csrsummon(View* view) {
size_t col = SIZE_MAX, row = SIZE_MAX;
find_cursor(view, &col, &row);
- move = (move < 0 ? -1 : 1) * view->nrows;
- view_scroll(view, move);
- size_t off = view->rows[view->nrows/2]->off;
-
-// size_t scrbeg = view->rows[0]->off;
-// size_t scrend = view->rows[view->nrows-1]->off + view->rows[view->nrows-1]->rlen - 1;
-// if (scrbeg == 0)
-// off = 0;
-// else if (scrend >= buf_end(&(view->buffer)))
-// off = view->rows[view->nrows-1]->off;
-
-// size_t off = (move == UP ? view->rows[0]->off : view->rows[view->nrows/2]->off);
-// if (row != SIZE_MAX && col != SIZE_MAX) {
-// off = view->rows[row]->off + col;
-// if (col >= view->rows[row]->rlen)
-// off = view->rows[row]->off + view->rows[row]->rlen - 1;
-// }
-
+ size_t off = view->rows[view->nrows/2]->off;
if (row != SIZE_MAX && col != SIZE_MAX)
if (col >= view->rows[view->nrows/2]->rlen)
off = view->rows[view->nrows/2]->off + view->rows[view->nrows/2]->rlen - 1;
else
off += col;
-
view_jumpto(view, false, off);
view->sync_needed = false;
}
+void view_scrollpage(View* view, int move) {
+ move = (move < 0 ? -1 : 1) * view->nrows;
+ view_scroll(view, move);
+ view_csrsummon(view);
+}
+
void view_indent(View* view, int dir) {
Buf* buf = &(view->buffer);
unsigned indoff = (buf->expand_tabs ? TabWidth : 1);
#ifndef TEST
#include <unistd.h>
-#include <util.h>
#include <sys/ioctl.h>
+#ifdef __MACH__
+#include <util.h>
+#else
+#include <pty.h>
+#endif
void spawn_shell(int master, int slave) {
static char* shell[] = { "/bin/sh", "-l", NULL };
static KeyBinding Bindings[] = {
/* Cursor Movements */
- { ModAny, KEY_HOME, cursor_home },
- { ModAny, KEY_END, cursor_end },
- { ModAny, KEY_UP, cursor_up },
- { ModAny, KEY_DOWN, cursor_dn },
- { ModAny, KEY_LEFT, cursor_left },
- { ModAny, KEY_RIGHT, cursor_right },
+ { ModAny, KEY_HOME, cursor_home },
+ { ModAny, KEY_END, cursor_end },
+ { ModAny, KEY_UP, cursor_up },
+ { ModAny, KEY_DOWN, cursor_dn },
+ { ModAny, KEY_LEFT, cursor_left },
+ { ModAny, KEY_RIGHT, cursor_right },
+ { ModCtrl, ';', cursor_warp },
/* Standard Unix Shortcuts */
{ ModCtrl, 'u', del_to_bol },
/* search for a ctags index file indicating the project root */
if (try_chdir(path)) {
- currdir = getcurrdir();
- currpath = calloc(strlen(currdir) + strlen("/tags") + 1, 1);
- relpath = calloc(strlen(currdir) + strlen("/tags") + 1, 1);
+ currdir = getcurrdir();
+ size_t sz = strlen(currdir) + strlen(path) + strlen("/tags") + 1;
+ currpath = calloc(sz, 1);
+ relpath = calloc(sz, 1);
while (true) {
/* figure out the current path to check */
strconcat(currpath, currdir, "/tags", 0);
if (currdir && *currdir) {
char* fname = strrchr(path, '/')+1;
if (*relpath)
- strconcat(currpath, relpath+1, "/", fname, 0);
+ strconcat(currpath, (*relpath == '/' ? relpath+1 : relpath), "/", fname, 0);
else
strconcat(currpath, fname, 0);
chdir(currdir);