commit d511dc85821b8a4d9bb84cb2baad16cf6003808b from: Omar Polo date: Tue Mar 16 21:43:01 2021 UTC keep the cursor at the start of the "real line" after redraw commit - 452589f7d5b31b9bc9b6af1c62d015bdd97b799c commit + d511dc85821b8a4d9bb84cb2baad16cf6003808b blob - 3a58a2074e4f9d8657d775fb48d584e87ad31da4 blob + ca4f5f5c7c4f6358268687b96fb503591e3a8d81 --- ui.c +++ ui.c @@ -1119,6 +1119,7 @@ wrap_page(struct tab *tab) { struct line *l; const struct line *orig; + struct vline *vl; const char *prfx; orig = tab->s.current_line == NULL @@ -1153,6 +1154,14 @@ wrap_page(struct tab *tab) if (orig == l && tab->s.current_line == NULL) { tab->s.line_off = tab->s.line_max-1; tab->s.current_line = TAILQ_LAST(&tab->s.head, vhead); + + while (1) { + vl = TAILQ_PREV(tab->s.current_line, vhead, vlines); + if (vl == NULL || vl->parent != orig) + break; + tab->s.current_line = vl; + tab->s.line_off--; + } } }