commit 64923c4b5e7b04f634d578539ccbe12d34d63995 from: Omar Polo date: Thu Jul 15 13:07:17 2021 UTC fix the scroll commands forward_line(buffer, body_lines) is not a real scrolling. We need to move the top_line to have a nice effect. commit - c1a72389c0083bb0722cec6ca5f1589d3f6b7c0b commit + 64923c4b5e7b04f634d578539ccbe12d34d63995 blob - 20f703053c426d868e4fe21f1a84088c1292e982 blob + 567015ddcda859e1cf828c5f37e40fc1d2dc869f --- cmd.c +++ cmd.c @@ -179,13 +179,30 @@ cmd_scroll_line_down(struct buffer *buffer) void cmd_scroll_up(struct buffer *buffer) { - forward_line(buffer, -1*body_lines); + struct vline *vl; + int i; + + for (i = 0; i < body_lines; ++i) { + vl = TAILQ_PREV(buffer->top_line, vhead, vlines); + if (vl == NULL) + break; + buffer->top_line = vl; + forward_line(buffer, -1); + } } void cmd_scroll_down(struct buffer *buffer) { - forward_line(buffer, body_lines); + int i; + + for (i = 0; i < body_lines; ++i) { + if (!forward_line(buffer, +1)) + break; + + buffer->top_line = TAILQ_NEXT(buffer->top_line, + vlines); + } } void