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();
	}
}

void
kscrollup(const Arg* a)
{
	int n = a->i;
	if (n < 0)
		n = term.row + n;

	if (term.scr <= HISTSIZE-n) {
		term.scr += n;
		selscroll(0, n);
		tfulldirt();
	}
}

#if SCROLLBACK_MOUSE_ALTSCREEN_PATCH
int tisaltscr(void)
{
	return IS_SET(MODE_ALTSCREEN);
}
#endif // SCROLLBACK_MOUSE_ALTSCREEN_PATCH