aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-07-02 20:31:52 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-07-02 20:31:52 +0000
commitd5158b2432dfdd64c464b3da733dae4ab31e4b52 (patch)
treecac9b2439eb1e5cdeec536ec75804ec25764bbd8 /main.c
parentcsi: re-set cursor when switching between alt and normal screen (diff)
render: track last cursor position in absolute values
This seems to fix an issue where we sometimes saw "ghost" cursors when scrolling.
Diffstat (limited to 'main.c')
-rw-r--r--main.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/main.c b/main.c
index 1e835a5b..24371687 100644
--- a/main.c
+++ b/main.c
@@ -386,11 +386,11 @@ grid_render_scroll_reverse(struct context *c, struct buffer *buf,
static void
grid_render(struct context *c)
{
- static struct cursor last_cursor = {.linear = 0, .col = 0, .row = 0};
+ static int last_cursor;
if (tll_length(c->term.grid->damage) == 0 &&
tll_length(c->term.grid->scroll_damage) == 0 &&
- last_cursor.linear == c->term.cursor.linear)
+ last_cursor == c->term.cursor.linear)
{
return;
}
@@ -444,12 +444,11 @@ grid_render(struct context *c)
/* TODO: break out to function */
/* Re-render last cursor cell and current cursor cell */
-
- if (last_cursor.linear != c->term.cursor.linear) {
+ /* Make sure previous cursor is refreshed (to avoid "ghost" cursors) */
+ if (last_cursor != c->term.cursor.linear) {
struct damage prev_cursor = {
.type = DAMAGE_UPDATE,
- .range = {.start = c->term.grid->offset + last_cursor.linear,
- .length = 1},
+ .range = {.start = last_cursor, .length = 1},
};
grid_render_update(c, buf, &prev_cursor);
}
@@ -459,7 +458,7 @@ grid_render(struct context *c)
.range = {.start = c->term.grid->offset + c->term.cursor.linear, .length = 1},
};
grid_render_update(c, buf, &cursor);
- last_cursor = c->term.cursor;
+ last_cursor = c->term.grid->offset + c->term.cursor.linear;
c->term.grid->offset %= c->term.grid->size;