]> git.mdlowis.com Git - projs/tide.git/commitdiff
mouse no longer warps on failed searches and position warped mouse on first char...
authorMichael D. Lowis <mike.lowis@gentex.com>
Mon, 21 Jan 2019 21:15:28 +0000 (16:15 -0500)
committerMichael D. Lowis <mike.lowis@gentex.com>
Mon, 21 Jan 2019 21:15:28 +0000 (16:15 -0500)
TODO.md
foo [new file with mode: 0644]
src/lib/draw.c
src/tide.c

diff --git a/TODO.md b/TODO.md
index e117cf41ed03be41e2dd0e6bc66d939fcf2193ea..7b175484c133b5191e4081467b85a8c114e3dc7b 100644 (file)
--- 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 (file)
index 0000000..28d44e9
--- /dev/null
+++ b/foo
@@ -0,0 +1 @@
+asdsad
\ No newline at end of file
index 36cb1503b1b6156329e8fea947632072a6201b12..e842491de1b276717886b030aa808163b81bdbe8 100644 (file)
@@ -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);
index 53d769825a35ca69070171a9261e856a8ac5e40b..f3d7d3d40399a32e0682167e6705bc4da3f052a2 100644 (file)
@@ -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) {