From: Michael D. Lowis Date: Wed, 9 May 2018 12:44:37 +0000 (-0400) Subject: fixed cursor so it only gets drawn once X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=389cd1ae6c47ffb08d39bd45febf458ebe7061ba;p=projs%2Ftide.git fixed cursor so it only gets drawn once --- diff --git a/lib/view.c b/lib/view.c index e822022..cd0ffb3 100644 --- a/lib/view.c +++ b/lib/view.c @@ -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; diff --git a/lib/x11.c b/lib/x11.c index a1b9e2e..b302909 100644 --- 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;