commit 0a805b02e875d567d6752130f6a8ad13954ddf58 from: Omar Polo date: Thu Jul 01 15:59:24 2021 UTC retire restore_cursor and the force-redraw optimization (for now) don't consider restore_cursor as a public interface and while there rename it as restore_curs_x, as it describes better the behaviour of the function. I have to disable the buffer->force-redraw optimization, at least from now, given that cmd.c don't update curs_y anymore, and with that optimisation in place the cursor y position doesn't get updated upon redraw. Add a comment as a future note though. commit - c4c8200352fa44cde50cbd6d44b395be3da28959 commit + 0a805b02e875d567d6752130f6a8ad13954ddf58 blob - 55a513ad69b5e71102390f476f64fe812173825c blob + d0aa00a41fe1b7d1c3f698c0aa612c1497938598 --- telescope.h +++ telescope.h @@ -465,7 +465,6 @@ extern struct ministate ministate; void save_excursion(struct excursion *, struct buffer *); void restore_excursion(struct excursion *, struct buffer *); -void restore_cursor(struct buffer *); void minibuffer_taint_hist(void); void eecmd_self_insert(void); void eecmd_select(void); blob - ecec3c4b0de9dec0998e41844a293067f80e08c1 blob + 06a3922d220a391b8a27c9aae0e6dc6d3c015505 --- ui.c +++ ui.c @@ -45,6 +45,7 @@ static struct event stdioev, winchev; +static void restore_curs_x(struct buffer *); static void global_key_unbound(void); static void minibuffer_hist_save_entry(void); static void minibuffer_self_insert(void); @@ -152,8 +153,8 @@ restore_excursion(struct excursion *place, struct buff buffer->cpoff = place->cpoff; } -void -restore_cursor(struct buffer *buffer) +static void +restore_curs_x(struct buffer *buffer) { struct vline *vl; const char *prfx; @@ -788,16 +789,15 @@ redraw_window(WINDOW *win, int height, int width, stru struct vline *vl; int l, onscreen; - restore_cursor(buffer); + restore_curs_x(buffer); /* - * Don't bother redraw the body if nothing changed. Cursor - * movements count as "nothing changed" if it hasn't produced - * a scroll. Ensure that wmove is called though! + * TODO: ignoring buffer->force_update and always + * re-rendering. In theory we can recompute the y position + * without a re-render, and optimize here. It's not the only + * optimisation possible here, wscrl wolud also be an + * interesting one. */ - if (!buffer->force_redraw && - buffer->last_line_off == buffer->line_off) - goto end; again: werase(win);