]> git.mdlowis.com Git - projs/tide.git/commitdiff
fixed cursor so it only gets drawn once
authorMichael D. Lowis <mike.lowis@gentex.com>
Wed, 9 May 2018 12:44:37 +0000 (08:44 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Wed, 9 May 2018 12:44:37 +0000 (08:44 -0400)
lib/view.c
lib/x11.c

index e8220221843ef5ee4e0d2f3fdb9c6a6cfaf38c64..cd0ffb36edc70a313cfdc33a306a8715aea61a45 100644 (file)
@@ -84,7 +84,7 @@ size_t view_limitrows(View* view, size_t maxrows, size_t ncols) {
         if (last >= bend)
             break;
     }
-    printf("%lu %lu\n", nrows, bend);
+    //printf("%lu %lu\n", nrows, bend);
     view_resize(view, view->width, nrows);
     view_update(view, 0, 0);
     return nrows;
index a1b9e2e4ddc1a4294a0928212d9c78f1ea22c8bc..b302909ac1ea77674911f93f2d344ca90ce78200 100644 (file)
--- a/lib/x11.c
+++ b/lib/x11.c
@@ -287,6 +287,7 @@ static void draw_rect(int color, int x, int y, int width, int height) {
 static void draw_view(int i, size_t nrows, drawcsr* csr, int bg, int fg, int sel) {
     size_t fheight = X.font->height;
     size_t csrx = SIZE_MAX, csry = SIZE_MAX;
+    bool csr_drawn = false;
     /* draw the view to the window */
     View* view = win_view(i);
     view_resize(view, (csr->w - csr->x), nrows);
@@ -304,8 +305,10 @@ static void draw_view(int i, size_t nrows, drawcsr* csr, int bg, int fg, int sel
                 rune = ' ';
             if (buf_insel(&(view->buffer), row->cols[i].off))
                 draw_rect(sel, x, y, row->cols[i].width, fheight);
-            if (!view_selsize(view) && row->cols[i].off == view->buffer.selection.end)
+            if (!csr_drawn && !view_selsize(view) && row->cols[i].off == view->buffer.selection.end) {
                 draw_rect((i == TAGS ? TagsCsr : EditCsr), x, y, 1, fheight);
+                csr_drawn = true;
+            }
             specs[i].glyph = XftCharIndex(X.display, X.font, rune);
             specs[i].x = x;
             specs[i].y = y + X.font->ascent;