From: Michael D. Lowis Date: Mon, 21 Jan 2019 21:15:28 +0000 (-0500) Subject: mouse no longer warps on failed searches and position warped mouse on first char... X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=8576a63358fb4ede197a973520c554a1f7c74bbe;p=projs%2Ftide.git mouse no longer warps on failed searches and position warped mouse on first char of selection --- diff --git a/TODO.md b/TODO.md index e117cf4..7b17548 100644 --- a/TODO.md +++ b/TODO.md @@ -8,7 +8,6 @@ * registrar: group by hostname or group env var in registrar * registrar: should cleanup invalid windows * tide: gap buffer does not handle UTF-8 currently -* tide: search should not warp pointer when nothing found ## BACKLOG diff --git a/foo b/foo new file mode 100644 index 0000000..28d44e9 --- /dev/null +++ b/foo @@ -0,0 +1 @@ +asdsad \ No newline at end of file diff --git a/src/lib/draw.c b/src/lib/draw.c index 36cb150..e842491 100644 --- a/src/lib/draw.c +++ b/src/lib/draw.c @@ -43,12 +43,11 @@ void draw_view(XConf* x, View* view, XftFont* font, size_t nrows, drawcsr* csr, rune = ' '; if (buf_insel(&(view->buffer), row->cols[i].off)) draw_rect(x, sel, posx, y, row->cols[i].width, fheight); - if (row->cols[i].off == view->buffer.selection.end) { + if (row->cols[i].off == view->buffer.selection.end) csr_drawn = draw_csr(x, view, fg, fheight, posx, y, csr_drawn); - if (csrsync) { - XWarpPointer(x->display, None, x->self, 0, 0, x->width, x->height, posx-4, y + fheight/2); - csrsync = false; - } + if (csrsync && row->cols[i].off == view->buffer.selection.beg) { + XWarpPointer(x->display, None, x->self, 0, 0, x->width, x->height, posx + row->cols[i].width/2, y + fheight*3/4); + csrsync = false; } specs = realloc(specs, sizeof(XftGlyphSpec) * ++nspecs); specs[nspecs-1].glyph = XftCharIndex(x->display, font, rune); diff --git a/src/tide.c b/src/tide.c index 53d7698..f3d7d3d 100644 --- a/src/tide.c +++ b/src/tide.c @@ -673,10 +673,9 @@ static void search(char* arg) { str = strdup(SearchTerm); else str = view_getctx(win_view(FOCUSED)); - view_findstr(win_view(EDIT), SearchDir, str); + SyncMouse = view_findstr(win_view(EDIT), SearchDir, str); free(SearchTerm); SearchTerm = str; - SyncMouse = true; } static void execute(char* arg) {