st/patch/scrollback.c

45 lines
567 B
C
Raw Normal View History

2019-09-16 15:31:58 +02:00
void
kscrolldown(const Arg* a)
{
int n = a->i;
if (n < 0)
n = term.row + n;
if (n > term.scr)
n = term.scr;
if (term.scr > 0) {
term.scr -= n;
selscroll(0, -n);
tfulldirt();
}
#if SIXEL_PATCH
scroll_images(-1*n);
#endif // SIXEL_PATCH
2019-09-16 15:31:58 +02:00
}
void
kscrollup(const Arg* a)
{
int n = a->i;
if (n < 0)
n = term.row + n;
if (term.scr + n > term.histi)
n = term.histi - term.scr;
if (!n)
return;
2019-09-16 15:31:58 +02:00
if (term.scr <= HISTSIZE-n) {
term.scr += n;
selscroll(0, n);
tfulldirt();
}
#if SIXEL_PATCH
scroll_images(n);
#endif // SIXEL_PATCH
2019-09-16 15:31:58 +02:00
}